1: /*
   2:  * Copyright (c) 1989 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n";
   9: static char SccsId[] = "@(#)@(#)pop_pass.c	2.3  2.3 4/2/91";
  10: #endif not lint
  11: 
  12: #include <stdio.h>
  13: #include <sys/types.h>
  14: #include <strings.h>
  15: #include <pwd.h>
  16: #include "popper.h"
  17: 
  18: /*
  19:  *  pass:   Obtain the user password from a POP client
  20:  */
  21: 
  22: int pop_pass (p)
  23: POP     *   p;
  24: {
  25:     register struct passwd  *   pw;
  26:     char *crypt();
  27: 
  28:     /*  Look for the user in the password file */
  29:     if ((pw = getpwnam(p->user)) == NULL)
  30:         return (pop_msg(p,POP_FAILURE,
  31:             "Password supplied for \"%s\" is incorrect.",p->user));
  32: 
  33:     /*  We don't accept connections from users with null passwords */
  34:     if (pw->pw_passwd == NULL)
  35:         return (pop_msg(p,POP_FAILURE,
  36:             "Password supplied for \"%s\" is incorrect.",p->user));
  37: 
  38:     /*  Compare the supplied password with the password file entry */
  39:     if (strcmp (crypt (p->pop_parm[1], pw->pw_passwd), pw->pw_passwd) != 0)
  40:         return (pop_msg(p,POP_FAILURE,
  41:             "Password supplied for \"%s\" is incorrect.",p->user));
  42: 
  43:     /*  Build the name of the user's maildrop */
  44:     (void)sprintf(p->drop_name,"%s/%s",POP_MAILDIR,p->user);
  45: 
  46:     /*  Make a temporary copy of the user's maildrop */
  47:     /*    and set the group and user id */
  48:     if (pop_dropcopy(p,pw) != POP_SUCCESS) return (POP_FAILURE);
  49: 
  50:     /*  Get information about the maildrop */
  51:     if (pop_dropinfo(p) != POP_SUCCESS) return(POP_FAILURE);
  52: 
  53:     /*  Initialize the last-message-accessed number */
  54:     p->last_msg = 0;
  55: 
  56:     /*  Authorization completed successfully */
  57:     return (pop_msg (p,POP_SUCCESS,
  58:         "%s has %u message(s) (%ld octets).",
  59:             p->user,p->msg_count,p->drop_size));
  60: }

Defined functions

pop_pass defined in line 22; used 1 times

Defined variables

SccsId defined in line 9; never used
copyright defined in line 8; never used
Last modified: 1992-06-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2866
Valid CSS Valid XHTML 1.0 Strict