From: Mark Eichin Date: Sun, 14 Aug 1994 04:22:12 +0000 (+0000) Subject: check for wait type X-Git-Tag: krb5-1.0-beta4.3~192 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0a7030720e8a773cf9a98f33ffe11536b8cdbf15;p=krb5.git check for wait type punt stat altogether (variable wasn't used) use off_t use mem* not b*, str* not index use sys/fcntl.h git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4131 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/popper/configure.in b/src/appl/popper/configure.in index 135f462ad..45ec8a0de 100644 --- a/src/appl/popper/configure.in +++ b/src/appl/popper/configure.in @@ -10,6 +10,7 @@ AC_HAVE_LIBRARY(nsl) AC_HAVE_LIBRARY(BSD) AC_HAVE_LIBRARY(ndbm) AC_HAVE_LIBRARY(dbm) +CHECK_WAIT_TYPE AC_HEADER_CHECK(flock.h,[echo found flock.h for non-posix locks], AC_COMPILE_CHECK([POSIX file locking -- structs and flags], diff --git a/src/appl/popper/pop_dropcopy.c b/src/appl/popper/pop_dropcopy.c index 0e9740649..18b3ff2d8 100644 --- a/src/appl/popper/pop_dropcopy.c +++ b/src/appl/popper/pop_dropcopy.c @@ -23,7 +23,6 @@ static char SccsId[] = "@(#)pop_dropcopy.c 2.6 4/3/91"; #else #include #endif -#include #include #include #include "popper.h" @@ -46,7 +45,6 @@ struct passwd * pwp; char buffer[BUFSIZ]; /* Read buffer */ off_t offset; /* Old/New boundary */ int nchar; /* Bytes written/read */ - struct stat mybuf; /* For lstat() */ #ifdef POSIX_FILE_LOCKS struct flock lock_arg; #endif @@ -143,7 +141,7 @@ struct passwd * pwp; #endif /* May have grown or shrunk between open and lock! */ - offset = lseek(dfd,0,SEEK_END); + offset = lseek(dfd,(off_t)0,SEEK_END); /* Open the user's maildrop, If this fails, no harm in assuming empty */ if ((mfd = open(p->drop_name,O_RDWR)) > 0) { diff --git a/src/appl/popper/pop_enter.c b/src/appl/popper/pop_enter.c index 5bc69bad3..3601c74d9 100644 --- a/src/appl/popper/pop_enter.c +++ b/src/appl/popper/pop_enter.c @@ -47,7 +47,7 @@ main (argc, argv) { if(open_drop(argv[i]) < 0) { - lseek(newmail, 0, L_SET); + lseek(newmail, (off_t)0, SEEK_SET); if(new_message(maildrop, newmail) < 0) status = 1; if(close(maildrop) < 0) @@ -115,7 +115,7 @@ open_drop(name) return(-1); } - lseek(maildrop, 0, L_XTND); + lseek(maildrop, (off_t)0, SEEK_END); return(0); } diff --git a/src/appl/popper/pop_init.c b/src/appl/popper/pop_init.c index 66dd1ee98..335c201d3 100644 --- a/src/appl/popper/pop_init.c +++ b/src/appl/popper/pop_init.c @@ -53,7 +53,7 @@ char ** argmessage; int standalone = 0; /* Initialize the POP parameter block */ - bzero ((char *)p,(int)sizeof(POP)); + memset ((char *)p, 0, (int)sizeof(POP)); /* Save my name in a global variable */ p->myname = argmessage[0]; @@ -210,7 +210,7 @@ char ** argmessage; /* Look for the client's IP address in the list returned for its name */ for (addrp=ch_again->h_addr_list; *addrp; ++addrp) - if (bcmp(*addrp,&(cs.sin_addr),sizeof(cs.sin_addr)) == 0) break; + if (memcmp(*addrp,&(cs.sin_addr),sizeof(cs.sin_addr)) == 0) break; if (!*addrp) { pop_log (p,POP_PRIORITY, diff --git a/src/appl/popper/pop_pass.c b/src/appl/popper/pop_pass.c index 3364a633f..917441f98 100644 --- a/src/appl/popper/pop_pass.c +++ b/src/appl/popper/pop_pass.c @@ -56,7 +56,6 @@ POP * p; #ifdef KRB5 char *lrealm; krb5_data *tmpdata; - krb5_error_code retval; #endif /* KRB5 */ #else register struct passwd * pw; @@ -90,12 +89,16 @@ POP * p; #endif /* KRB4 */ #ifdef KRB5 #ifdef NO_CROSSREALM + { + krb5_error_code retval; + if (retval = krb5_get_default_realm(&lrealm)) { pop_log(p, POP_WARNING, "%s: (%s) %s", p->client, client_name, error_message(retval)); return(pop_msg(p,POP_FAILURE, "Kerberos error: \"%s\".", error_message(retval))); } + } tmpdata = krb5_princ_realm(ext_client); if (strncmp(tmpdata->data, lrealm, tmpdata->length)) { @@ -219,10 +222,10 @@ our_getpwnam(user) if(!(fp = fopen(pwfile, "r"))) return(NULL); - bzero(&p, sizeof(p)); + memset(&p, 0, sizeof(p)); while(fgets(buf, sizeof(buf), fp)) { - if(!(c = (char *) index(buf, ':'))) + if(!(c = (char *) strchr(buf, ':'))) continue; *c++ = '\0'; @@ -232,11 +235,11 @@ our_getpwnam(user) p.pw_name = strdup(buf); #ifdef hpux - if (!(d = (char *) index(c, ':'))) + if (!(d = (char *) strchr(c, ':'))) return(&p); #else - if(!((d = (char *) index(c, ':')) && (c = (char *) index(++d, ':')) && - (d = (char *) index(++c, ':')))) + if(!((d = (char *) strchr(c, ':')) && (c = (char *) strchr(++d, ':')) && + (d = (char *) strchr(++c, ':')))) return(&p); #endif *d = '\0'; diff --git a/src/appl/popper/pop_send.c b/src/appl/popper/pop_send.c index 03a7881c9..82196d827 100644 --- a/src/appl/popper/pop_send.c +++ b/src/appl/popper/pop_send.c @@ -107,7 +107,7 @@ char * buffer; if (*buffer == POP_TERMINATE) (void)fputc(POP_TERMINATE,p->output); /* Look for a in the buffer */ - if (bp = index(buffer,NEWLINE)) *bp = 0; + if (bp = strchr(buffer,NEWLINE)) *bp = 0; /* Send the line to the client */ (void)fputs(buffer,p->output); diff --git a/src/appl/popper/pop_updt.c b/src/appl/popper/pop_updt.c index 2b4752c52..08e2f6b54 100644 --- a/src/appl/popper/pop_updt.c +++ b/src/appl/popper/pop_updt.c @@ -104,7 +104,7 @@ POP * p; #endif /* Go to the right places */ - offset = lseek((int)fileno(p->drop),0,L_XTND) ; + offset = lseek((int)fileno(p->drop),(off_t)0,SEEK_END) ; /* Append any messages that may have arrived during the session to the temporary maildrop */ @@ -125,7 +125,7 @@ POP * p; /* Synch stdio and the kernel for the POP drop */ rewind(p->drop); - (void)lseek((int)fileno(p->drop),0,L_SET); + (void)lseek((int)fileno(p->drop),(off_t)0,SEEK_SET); /* Transfer messages not flagged for deletion from the temporary maildrop to the new maildrop */ @@ -228,7 +228,7 @@ POP * p; } /* Go to start of new mail if any */ - (void)lseek((int)fileno(p->drop),offset,L_SET); + (void)lseek((int)fileno(p->drop),offset,SEEK_SET); while((nchar=read((int)fileno(p->drop),buffer,BUFSIZ)) > 0) if ( nchar != write(mfd,buffer,nchar) ) { diff --git a/src/appl/popper/pop_xmit.c b/src/appl/popper/pop_xmit.c index 0c903f965..22582b77e 100644 --- a/src/appl/popper/pop_xmit.c +++ b/src/appl/popper/pop_xmit.c @@ -13,6 +13,7 @@ static char SccsId[] = "@(#)pop_xmit.c 2.1 3/18/91"; #include #include #include +#include #ifdef HAS_PATHS_H #include #endif @@ -35,7 +36,11 @@ POP * p; char buffer[MAXLINELEN]; /* Read buffer */ char * temp_xmit; /* Name of the temporary filedrop */ +#ifdef WAIT_USES_INT + int stat; +#else union wait stat; +#endif int id, pid; /* Create a temporary file into which to copy the user's message */ @@ -92,7 +97,11 @@ POP * p; default: while((id = wait(&stat)) >=0 && id != pid); if (!p->debug) (void)unlink (temp_xmit); +#ifdef WAIT_USES_INT + if (WEXITSTATUS(stat)) +#else if (stat.w_retcode) +#endif return (pop_msg(p,POP_FAILURE,"Unable to send message")); return (pop_msg (p,POP_SUCCESS,"Message sent successfully")); }