diff options
| -rw-r--r-- | src/usr.bin/openssl/apps.c | 71 | ||||
| -rw-r--r-- | src/usr.bin/openssl/apps.h | 3 |
2 files changed, 2 insertions, 72 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c index f5f1248c07..44b304a98b 100644 --- a/src/usr.bin/openssl/apps.c +++ b/src/usr.bin/openssl/apps.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: apps.c,v 1.64 2023/04/22 20:50:26 tb Exp $ */ | 1 | /* $OpenBSD: apps.c,v 1.65 2023/06/11 12:35:00 jsg Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -200,75 +200,6 @@ program_name(char *in, char *out, int size) | |||
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | int | 202 | int |
| 203 | chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) | ||
| 204 | { | ||
| 205 | int num, i; | ||
| 206 | char *p; | ||
| 207 | |||
| 208 | *argc = 0; | ||
| 209 | *argv = NULL; | ||
| 210 | |||
| 211 | if (arg->count == 0) { | ||
| 212 | arg->count = 20; | ||
| 213 | arg->data = reallocarray(NULL, arg->count, sizeof(char *)); | ||
| 214 | if (arg->data == NULL) | ||
| 215 | return 0; | ||
| 216 | } | ||
| 217 | for (i = 0; i < arg->count; i++) | ||
| 218 | arg->data[i] = NULL; | ||
| 219 | |||
| 220 | num = 0; | ||
| 221 | p = buf; | ||
| 222 | for (;;) { | ||
| 223 | /* first scan over white space */ | ||
| 224 | if (!*p) | ||
| 225 | break; | ||
| 226 | while (*p && ((*p == ' ') || (*p == '\t') || (*p == '\n'))) | ||
| 227 | p++; | ||
| 228 | if (!*p) | ||
| 229 | break; | ||
| 230 | |||
| 231 | /* The start of something good :-) */ | ||
| 232 | if (num >= arg->count) { | ||
| 233 | char **tmp_p; | ||
| 234 | int tlen = arg->count + 20; | ||
| 235 | tmp_p = reallocarray(arg->data, tlen, sizeof(char *)); | ||
| 236 | if (tmp_p == NULL) | ||
| 237 | return 0; | ||
| 238 | arg->data = tmp_p; | ||
| 239 | arg->count = tlen; | ||
| 240 | /* initialize newly allocated data */ | ||
| 241 | for (i = num; i < arg->count; i++) | ||
| 242 | arg->data[i] = NULL; | ||
| 243 | } | ||
| 244 | arg->data[num++] = p; | ||
| 245 | |||
| 246 | /* now look for the end of this */ | ||
| 247 | if ((*p == '\'') || (*p == '\"')) { /* scan for closing | ||
| 248 | * quote */ | ||
| 249 | i = *(p++); | ||
| 250 | arg->data[num - 1]++; /* jump over quote */ | ||
| 251 | while (*p && (*p != i)) | ||
| 252 | p++; | ||
| 253 | *p = '\0'; | ||
| 254 | } else { | ||
| 255 | while (*p && ((*p != ' ') && | ||
| 256 | (*p != '\t') && (*p != '\n'))) | ||
| 257 | p++; | ||
| 258 | |||
| 259 | if (*p == '\0') | ||
| 260 | p--; | ||
| 261 | else | ||
| 262 | *p = '\0'; | ||
| 263 | } | ||
| 264 | p++; | ||
| 265 | } | ||
| 266 | *argc = num; | ||
| 267 | *argv = arg->data; | ||
| 268 | return (1); | ||
| 269 | } | ||
| 270 | |||
| 271 | int | ||
| 272 | dump_cert_text(BIO *out, X509 *x) | 203 | dump_cert_text(BIO *out, X509 *x) |
| 273 | { | 204 | { |
| 274 | char *p; | 205 | char *p; |
diff --git a/src/usr.bin/openssl/apps.h b/src/usr.bin/openssl/apps.h index 82e0662c88..addc6b031f 100644 --- a/src/usr.bin/openssl/apps.h +++ b/src/usr.bin/openssl/apps.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: apps.h,v 1.32 2023/04/14 15:27:13 tb Exp $ */ | 1 | /* $OpenBSD: apps.h,v 1.33 2023/06/11 12:35:00 jsg Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -159,7 +159,6 @@ int should_retry(int i); | |||
| 159 | int args_from_file(char *file, int *argc, char **argv[]); | 159 | int args_from_file(char *file, int *argc, char **argv[]); |
| 160 | int str2fmt(char *s); | 160 | int str2fmt(char *s); |
| 161 | void program_name(char *in, char *out, int size); | 161 | void program_name(char *in, char *out, int size); |
| 162 | int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]); | ||
| 163 | #ifdef HEADER_X509_H | 162 | #ifdef HEADER_X509_H |
| 164 | int dump_cert_text(BIO *out, X509 *x); | 163 | int dump_cert_text(BIO *out, X509 *x); |
| 165 | void print_name(BIO *out, const char *title, X509_NAME *nm, | 164 | void print_name(BIO *out, const char *title, X509_NAME *nm, |
