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],
#else
#include <string.h>
#endif
-#include <sys/stat.h>
#include <sys/file.h>
#include <pwd.h>
#include "popper.h"
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
#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) {
{
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)
return(-1);
}
- lseek(maildrop, 0, L_XTND);
+ lseek(maildrop, (off_t)0, SEEK_END);
return(0);
}
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];
/* 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,
#ifdef KRB5
char *lrealm;
krb5_data *tmpdata;
- krb5_error_code retval;
#endif /* KRB5 */
#else
register struct passwd * pw;
#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)) {
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';
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';
if (*buffer == POP_TERMINATE) (void)fputc(POP_TERMINATE,p->output);
/* Look for a <NL> 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);
#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 */
/* 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 */
}
/* 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) ) {
#include <sys/types.h>
#include <sys/file.h>
#include <sys/wait.h>
+#include <sys/fcntl.h>
#ifdef HAS_PATHS_H
#include <paths.h>
#endif
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 */
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"));
}