From: Dan Harkless Date: Tue, 9 May 2000 21:44:15 +0000 (+0000) Subject: * Changed configure.in to use gcc -Wall even without --enable-debug, to prevent X-Git-Tag: kim-before-sasl~38 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=e0233d70fb7bfac996b3514ae60d7eedef0e6ad3;p=mmh * Changed configure.in to use gcc -Wall even without --enable-debug, to prevent developers compiling optimized from introducing warnings, and to give end-users a warm, fuzzy feeling as they (hopefully) see no warnings come out (except perhaps on the lex output file) even with -Wall. * Renamed getpass() to nmh_getpass() since the prototype for getpass() varies from OS to OS, and we want to _always_ use our version of the function. Fixed all the callers to use nmh_getpass() and added it to prototypes.h. Semi-arbitrarily upped MAX_PASSWORD_LEN from 128 to 256. buf was being calloc()'d and the memory leaked -- should have just been declared as static char array. Prepended "Portions of this code are" to the copyright message, as this version has been changed significantly from the BSD version. * Added "nmh-local functions to use in preference to OS versions" section to README.developers (currently just says to use nmh_getpass() instead of system getpass()). --- diff --git a/ChangeLog b/ChangeLog index d26f289..5f2e3a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Tue May 09 01:13:52 2000 Dan Harkless +Tue May 09 14:38:32 2000 Dan Harkless * Alphabetized Shantonu's $pop_kinds output on configure's "pop is enabled" line. If POP3 is the only kind of POP enabled, say so, @@ -12,6 +12,26 @@ Tue May 09 01:13:52 2000 Dan Harkless * Added steps to README.developers saying to change the version number to X.Y.Z+dev. Did a little rearranging and changed the FTP dir from /home/ftp to /var/ftp to reflect Doug's new machine. + + * Changed configure.in to use gcc -Wall even without + --enable-debug, to prevent developers compiling optimized from + introducing warnings, and to give end-users a warm, fuzzy feeling + as they (hopefully) see no warnings come out (except perhaps on + the lex output file) even with -Wall. + + * Renamed getpass() to nmh_getpass() since the prototype for + getpass() varies from OS to OS, and we want to _always_ use our + version of the function. Fixed all the callers to use + nmh_getpass() and added it to prototypes.h. Semi-arbitrarily + upped MAX_PASSWORD_LEN from 128 to 256. buf was being calloc()'d + and the memory leaked -- should have just been declared as static + char array. Prepended "Portions of this code are" to the + copyright message, as this version has been changed significantly + from the BSD version. + + * Added "nmh-local functions to use in preference to OS versions" + section to README.developers (currently just says to use + nmh_getpass() instead of system getpass()). Mon May 08 23:51:55 2000 Dan Harkless diff --git a/configure b/configure index ea95842..f61647d 100755 --- a/configure +++ b/configure @@ -1063,7 +1063,7 @@ if test -n "$auto_cflags"; then else test -z "$LDFLAGS" && LDFLAGS=-s if test -n "$GCC"; then - test -z "$CFLAGS" && CFLAGS=-O2 || CFLAGS="$CFLAGS -O2" + test -z "$CFLAGS" && CFLAGS="-Wall -O2" || CFLAGS="$CFLAGS -Wall -O2" else test -z "$CFLAGS" && CFLAGS=-O || CFLAGS="$CFLAGS -O" fi diff --git a/configure.in b/configure.in index 957b3da..d68b624 100644 --- a/configure.in +++ b/configure.in @@ -192,7 +192,7 @@ if test -n "$auto_cflags"; then else test -z "$LDFLAGS" && LDFLAGS=-s if test -n "$GCC"; then - test -z "$CFLAGS" && CFLAGS=-O2 || CFLAGS="$CFLAGS -O2" + test -z "$CFLAGS" && CFLAGS="-Wall -O2" || CFLAGS="$CFLAGS -Wall -O2" else test -z "$CFLAGS" && CFLAGS=-O || CFLAGS="$CFLAGS -O" fi diff --git a/docs/README.developers b/docs/README.developers index b2c2efa..9314563 100644 --- a/docs/README.developers +++ b/docs/README.developers @@ -130,6 +130,21 @@ zotnet/tws/ "time". Date and time manipulation routines go here. +------------------------------------------------------- +nmh-local functions to use in preference to OS versions +------------------------------------------------------- + +For some system functions whose availability or behavior varies from OS to OS, +nmh conditionally uses a local definition with the same name as the OS function +(e.g. snprintf()). For other functions, developers need to avoid the OS +versions and always use the nmh-supplied function. Here is a list of such +functions: + +OS function nmh-local version to use instead +=========== ================================ +getpass() nmh_getpass() + + ------------- releasing nmh ------------- diff --git a/h/prototypes.h b/h/prototypes.h index 4b5a0b8..d252ead 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -81,6 +81,7 @@ char *m_scratch (char *, char *); char *m_tmpfil (char *); void m_unknown(FILE *); int makedir (char *); +char *nmh_getpass(const char *); char *new_fs (char *, char *, char *); char *path(char *, int); int peekc(FILE *ib); diff --git a/sbr/getpass.c b/sbr/getpass.c index a8238fb..b33a3f8 100644 --- a/sbr/getpass.c +++ b/sbr/getpass.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1988, 1993 + * Portions of this code are Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,27 +34,27 @@ */ #include -#include /* for calloc() */ #include #include /* for ttyname() */ #include "h/mh.h" /* for adios() */ -#define PASSWORD_LEN 128 +/* We don't use MAX_PASS here because the maximum password length on a remote + POP daemon will have nothing to do with the length on our OS. 256 is + arbitrary but hopefully big enough to accomodate everyone. */ +#define MAX_PASSWORD_LEN 256 #ifndef TCSANOW #define TCSANOW 0 #endif char * -getpass(const char *prompt) +nmh_getpass(const char *prompt) { struct termios oterm, term; int ch; - char *p, *ttystring, *buf; + char *p, *ttystring; FILE *fout, *fin; - - if(!(buf = (char *)calloc((size_t)(PASSWORD_LEN+1), sizeof(char)))) - adios(NULL, "unable to allocate string storage"); + static char buf[MAX_PASSWORD_LEN + 1]; /* Find if stdin is connect to a terminal. If so, read directly from * the terminal, and turn off echo. Otherwise read from stdin. @@ -75,9 +75,10 @@ getpass(const char *prompt) (void)tcsetattr(fileno(fin), TCSANOW, &term); } - for (p = buf; (ch = getc(fin)) != EOF && ch != '\n';) - if (p < buf + PASSWORD_LEN) - *p++ = ch; + for (p = buf; (ch = getc(fin)) != EOF && + ch != '\n' && + p < buf + MAX_PASSWORD_LEN;) + *p++ = ch; *p = '\0'; if(ttystring != NULL) { @@ -86,5 +87,5 @@ getpass(const char *prompt) (void)fputc('\n', fout); (void)fclose(fin); } - return((char *)buf); + return buf; } diff --git a/sbr/ruserpass.c b/sbr/ruserpass.c index 085d493..6045c32 100644 --- a/sbr/ruserpass.c +++ b/sbr/ruserpass.c @@ -162,7 +162,7 @@ done: char *mypass; snprintf(prompt, sizeof(prompt), "Password (%s:%s): ", host, *aname); - mypass = (char *)getpass (prompt); + mypass = nmh_getpass(prompt); if (*mypass == '\0') { mypass = *aname; diff --git a/stamp-h.in b/stamp-h.in index ba1d8ed..0158eaf 100644 --- a/stamp-h.in +++ b/stamp-h.in @@ -1 +1 @@ -Tue May 9 00:15:18 PDT 2000 +Tue May 9 13:12:44 PDT 2000 diff --git a/zotnet/bboards/getbbent.c b/zotnet/bboards/getbbent.c index aa3253e..c820d69 100644 --- a/zotnet/bboards/getbbent.c +++ b/zotnet/bboards/getbbent.c @@ -513,7 +513,7 @@ ldrchk (struct bboard *b) return 1; if (strcmp (b->bb_passwd, - crypt (getpass ("Password: "), b->bb_passwd)) == 0) + crypt (nmh_getpass ("Password: "), b->bb_passwd)) == 0) return 1; fprintf (stderr, "Sorry\n");