diff options
author | beck <> | 2002-05-15 02:29:21 +0000 |
---|---|---|
committer | beck <> | 2002-05-15 02:29:21 +0000 |
commit | b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch) | |
tree | fa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/des/read_pwd.c | |
parent | e471e1ea98d673597b182ea85f29e30c97cd08b5 (diff) | |
download | openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2 openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip |
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/des/read_pwd.c')
-rw-r--r-- | src/lib/libcrypto/des/read_pwd.c | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/src/lib/libcrypto/des/read_pwd.c b/src/lib/libcrypto/des/read_pwd.c index c27ec336e7..ae9aef620b 100644 --- a/src/lib/libcrypto/des/read_pwd.c +++ b/src/lib/libcrypto/des/read_pwd.c | |||
@@ -56,8 +56,8 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) | 59 | #include <openssl/e_os2.h> |
60 | #include <openssl/opensslconf.h> | 60 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_WIN32) |
61 | #ifdef OPENSSL_UNISTD | 61 | #ifdef OPENSSL_UNISTD |
62 | # include OPENSSL_UNISTD | 62 | # include OPENSSL_UNISTD |
63 | #else | 63 | #else |
@@ -78,7 +78,7 @@ | |||
78 | /* #define SIGACTION */ /* Define this if you have sigaction() */ | 78 | /* #define SIGACTION */ /* Define this if you have sigaction() */ |
79 | 79 | ||
80 | #ifdef WIN16TTY | 80 | #ifdef WIN16TTY |
81 | #undef WIN16 | 81 | #undef OPENSSL_SYS_WIN16 |
82 | #undef _WINDOWS | 82 | #undef _WINDOWS |
83 | #include <graph.h> | 83 | #include <graph.h> |
84 | #endif | 84 | #endif |
@@ -92,7 +92,7 @@ | |||
92 | #include <setjmp.h> | 92 | #include <setjmp.h> |
93 | #include <errno.h> | 93 | #include <errno.h> |
94 | 94 | ||
95 | #ifdef VMS /* prototypes for sys$whatever */ | 95 | #ifdef OPENSSL_SYS_VMS /* prototypes for sys$whatever */ |
96 | #include <starlet.h> | 96 | #include <starlet.h> |
97 | #ifdef __DECC | 97 | #ifdef __DECC |
98 | #pragma message disable DOLLARID | 98 | #pragma message disable DOLLARID |
@@ -127,12 +127,18 @@ | |||
127 | #undef SGTTY | 127 | #undef SGTTY |
128 | #endif | 128 | #endif |
129 | 129 | ||
130 | #if !defined(TERMIO) && !defined(TERMIOS) && !defined(VMS) && !defined(MSDOS) && !defined(MAC_OS_pre_X) && !defined(MAC_OS_GUSI_SOURCE) | 130 | #if !defined(TERMIO) && !defined(TERMIOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_MSDOS) && !defined(MAC_OS_pre_X) && !defined(MAC_OS_GUSI_SOURCE) |
131 | #undef TERMIOS | 131 | #undef TERMIOS |
132 | #undef TERMIO | 132 | #undef TERMIO |
133 | #define SGTTY | 133 | #define SGTTY |
134 | #endif | 134 | #endif |
135 | 135 | ||
136 | #if defined(OPENSSL_SYS_VSWORKS) | ||
137 | #undef TERMIOS | ||
138 | #undef TERMIO | ||
139 | #undef SGTTY | ||
140 | #endif | ||
141 | |||
136 | #ifdef TERMIOS | 142 | #ifdef TERMIOS |
137 | #include <termios.h> | 143 | #include <termios.h> |
138 | #define TTY_STRUCT struct termios | 144 | #define TTY_STRUCT struct termios |
@@ -157,16 +163,16 @@ | |||
157 | #define TTY_set(tty,data) ioctl(tty,TIOCSETP,data) | 163 | #define TTY_set(tty,data) ioctl(tty,TIOCSETP,data) |
158 | #endif | 164 | #endif |
159 | 165 | ||
160 | #if !defined(_LIBC) && !defined(MSDOS) && !defined(VMS) && !defined(MAC_OS_pre_X) | 166 | #if !defined(_LIBC) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(MAC_OS_pre_X) |
161 | #include <sys/ioctl.h> | 167 | #include <sys/ioctl.h> |
162 | #endif | 168 | #endif |
163 | 169 | ||
164 | #if defined(MSDOS) && !defined(__CYGWIN32__) | 170 | #if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__) |
165 | #include <conio.h> | 171 | #include <conio.h> |
166 | #define fgets(a,b,c) noecho_fgets(a,b,c) | 172 | #define fgets(a,b,c) noecho_fgets(a,b,c) |
167 | #endif | 173 | #endif |
168 | 174 | ||
169 | #ifdef VMS | 175 | #ifdef OPENSSL_SYS_VMS |
170 | #include <ssdef.h> | 176 | #include <ssdef.h> |
171 | #include <iodef.h> | 177 | #include <iodef.h> |
172 | #include <ttdef.h> | 178 | #include <ttdef.h> |
@@ -195,17 +201,17 @@ static void read_till_nl(FILE *); | |||
195 | static void recsig(int); | 201 | static void recsig(int); |
196 | static void pushsig(void); | 202 | static void pushsig(void); |
197 | static void popsig(void); | 203 | static void popsig(void); |
198 | #if defined(MSDOS) && !defined(WIN16) | 204 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) |
199 | static int noecho_fgets(char *buf, int size, FILE *tty); | 205 | static int noecho_fgets(char *buf, int size, FILE *tty); |
200 | #endif | 206 | #endif |
201 | #ifdef SIGACTION | 207 | #ifdef SIGACTION |
202 | static struct sigaction savsig[NX509_SIG]; | 208 | static struct sigaction savsig[NX509_SIG]; |
203 | #else | 209 | #else |
204 | static void (*savsig[NX509_SIG])(int ); | 210 | static void (*savsig[NX509_SIG])(int ); |
205 | #endif | 211 | #endif |
206 | static jmp_buf save; | 212 | static jmp_buf save; |
207 | 213 | ||
208 | int des_read_pw_string(char *buf, int length, const char *prompt, | 214 | int _ossl_old_des_read_pw_string(char *buf, int length, const char *prompt, |
209 | int verify) | 215 | int verify) |
210 | { | 216 | { |
211 | char buff[BUFSIZ]; | 217 | char buff[BUFSIZ]; |
@@ -216,7 +222,7 @@ int des_read_pw_string(char *buf, int length, const char *prompt, | |||
216 | return(ret); | 222 | return(ret); |
217 | } | 223 | } |
218 | 224 | ||
219 | #ifndef WIN16 | 225 | #ifndef OPENSSL_SYS_WIN16 |
220 | 226 | ||
221 | static void read_till_nl(FILE *in) | 227 | static void read_till_nl(FILE *in) |
222 | { | 228 | { |
@@ -233,14 +239,14 @@ static void read_till_nl(FILE *in) | |||
233 | int des_read_pw(char *buf, char *buff, int size, const char *prompt, | 239 | int des_read_pw(char *buf, char *buff, int size, const char *prompt, |
234 | int verify) | 240 | int verify) |
235 | { | 241 | { |
236 | #ifdef VMS | 242 | #ifdef OPENSSL_SYS_VMS |
237 | struct IOSB iosb; | 243 | struct IOSB iosb; |
238 | $DESCRIPTOR(terminal,"TT"); | 244 | $DESCRIPTOR(terminal,"TT"); |
239 | long tty_orig[3], tty_new[3]; | 245 | long tty_orig[3], tty_new[3]; |
240 | long status; | 246 | long status; |
241 | unsigned short channel = 0; | 247 | unsigned short channel = 0; |
242 | #else | 248 | #else |
243 | #ifndef MSDOS | 249 | #ifndef OPENSSL_SYS_MSDOS |
244 | TTY_STRUCT tty_orig,tty_new; | 250 | TTY_STRUCT tty_orig,tty_new; |
245 | #endif | 251 | #endif |
246 | #endif | 252 | #endif |
@@ -265,19 +271,19 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt, | |||
265 | is_a_tty=1; | 271 | is_a_tty=1; |
266 | tty=NULL; | 272 | tty=NULL; |
267 | 273 | ||
268 | #ifdef MSDOS | 274 | #ifdef OPENSSL_SYS_MSDOS |
269 | if ((tty=fopen("con","r")) == NULL) | 275 | if ((tty=fopen("con","r")) == NULL) |
270 | tty=stdin; | 276 | tty=stdin; |
271 | #elif defined(MAC_OS_pre_X) | 277 | #elif defined(MAC_OS_pre_X) || defined(OPENSSL_SYS_VSWORKS) |
272 | tty=stdin; | 278 | tty=stdin; |
273 | #else | 279 | #else |
274 | #ifndef MPE | 280 | #ifndef OPENSSL_SYS_MPE |
275 | if ((tty=fopen("/dev/tty","r")) == NULL) | 281 | if ((tty=fopen("/dev/tty","r")) == NULL) |
276 | #endif | 282 | #endif |
277 | tty=stdin; | 283 | tty=stdin; |
278 | #endif | 284 | #endif |
279 | 285 | ||
280 | #if defined(TTY_get) && !defined(VMS) | 286 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) |
281 | if (TTY_get(fileno(tty),&tty_orig) == -1) | 287 | if (TTY_get(fileno(tty),&tty_orig) == -1) |
282 | { | 288 | { |
283 | #ifdef ENOTTY | 289 | #ifdef ENOTTY |
@@ -296,7 +302,7 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt, | |||
296 | } | 302 | } |
297 | memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig)); | 303 | memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig)); |
298 | #endif | 304 | #endif |
299 | #ifdef VMS | 305 | #ifdef OPENSSL_SYS_VMS |
300 | status = sys$assign(&terminal,&channel,0,0); | 306 | status = sys$assign(&terminal,&channel,0,0); |
301 | if (status != SS$_NORMAL) | 307 | if (status != SS$_NORMAL) |
302 | return(-1); | 308 | return(-1); |
@@ -312,15 +318,15 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt, | |||
312 | tty_new.TTY_FLAGS &= ~ECHO; | 318 | tty_new.TTY_FLAGS &= ~ECHO; |
313 | #endif | 319 | #endif |
314 | 320 | ||
315 | #if defined(TTY_set) && !defined(VMS) | 321 | #if defined(TTY_set) && !defined(OPENSSL_SYS_VMS) |
316 | if (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1)) | 322 | if (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1)) |
317 | #ifdef MPE | 323 | #ifdef OPENSSL_SYS_MPE |
318 | ; /* MPE lies -- echo really has been disabled */ | 324 | ; /* MPE lies -- echo really has been disabled */ |
319 | #else | 325 | #else |
320 | return(-1); | 326 | return(-1); |
321 | #endif | 327 | #endif |
322 | #endif | 328 | #endif |
323 | #ifdef VMS | 329 | #ifdef OPENSSL_SYS_VMS |
324 | tty_new[0] = tty_orig[0]; | 330 | tty_new[0] = tty_orig[0]; |
325 | tty_new[1] = tty_orig[1] | TT$M_NOECHO; | 331 | tty_new[1] = tty_orig[1] | TT$M_NOECHO; |
326 | tty_new[2] = tty_orig[2]; | 332 | tty_new[2] = tty_orig[2]; |
@@ -366,14 +372,14 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt, | |||
366 | 372 | ||
367 | error: | 373 | error: |
368 | fprintf(stderr,"\n"); | 374 | fprintf(stderr,"\n"); |
369 | #ifdef DEBUG | 375 | #if 0 |
370 | perror("fgets(tty)"); | 376 | perror("fgets(tty)"); |
371 | #endif | 377 | #endif |
372 | /* What can we do if there is an error? */ | 378 | /* What can we do if there is an error? */ |
373 | #if defined(TTY_set) && !defined(VMS) | 379 | #if defined(TTY_set) && !defined(OPENSSL_SYS_VMS) |
374 | if (ps >= 2) TTY_set(fileno(tty),&tty_orig); | 380 | if (ps >= 2) TTY_set(fileno(tty),&tty_orig); |
375 | #endif | 381 | #endif |
376 | #ifdef VMS | 382 | #ifdef OPENSSL_SYS_VMS |
377 | if (ps >= 2) | 383 | if (ps >= 2) |
378 | status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0 | 384 | status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0 |
379 | ,tty_orig,12,0,0,0,0); | 385 | ,tty_orig,12,0,0,0,0); |
@@ -381,13 +387,13 @@ error: | |||
381 | 387 | ||
382 | if (ps >= 1) popsig(); | 388 | if (ps >= 1) popsig(); |
383 | if (stdin != tty) fclose(tty); | 389 | if (stdin != tty) fclose(tty); |
384 | #ifdef VMS | 390 | #ifdef OPENSSL_SYS_VMS |
385 | status = sys$dassgn(channel); | 391 | status = sys$dassgn(channel); |
386 | #endif | 392 | #endif |
387 | return(!ok); | 393 | return(!ok); |
388 | } | 394 | } |
389 | 395 | ||
390 | #else /* WIN16 */ | 396 | #else /* OPENSSL_SYS_WIN16 */ |
391 | 397 | ||
392 | int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify) | 398 | int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify) |
393 | { | 399 | { |
@@ -460,7 +466,7 @@ static void recsig(int i) | |||
460 | #endif | 466 | #endif |
461 | } | 467 | } |
462 | 468 | ||
463 | #if defined(MSDOS) && !defined(WIN16) | 469 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) |
464 | static int noecho_fgets(char *buf, int size, FILE *tty) | 470 | static int noecho_fgets(char *buf, int size, FILE *tty) |
465 | { | 471 | { |
466 | int i; | 472 | int i; |