-Tue May 09 01:13:52 2000 Dan Harkless <dan-nmh@dilvish.speed.net>
+Tue May 09 14:38:32 2000 Dan Harkless <dan-nmh@dilvish.speed.net>
* Alphabetized Shantonu's $pop_kinds output on configure's "pop is
enabled" line. If POP3 is the only kind of POP enabled, say so,
* 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 <dan-nmh@dilvish.speed.net>
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
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
"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
-------------
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);
/*
- * 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
*/
#include <stdio.h>
-#include <stdlib.h> /* for calloc() */
#include <termios.h>
#include <unistd.h> /* 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.
(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) {
(void)fputc('\n', fout);
(void)fclose(fin);
}
- return((char *)buf);
+ return buf;
}
char *mypass;
snprintf(prompt, sizeof(prompt), "Password (%s:%s): ", host, *aname);
- mypass = (char *)getpass (prompt);
+ mypass = nmh_getpass(prompt);
if (*mypass == '\0') {
mypass = *aname;
-Tue May 9 00:15:18 PDT 2000
+Tue May 9 13:12:44 PDT 2000
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");