home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / UNIX / ARCHIE / CLIENTS / XARCHIE0.TAR / get_pauth.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-27  |  750 b   |  36 lines

  1. /*
  2.  * Copyright (c) 1989, 1990 by the University of Washington
  3.  *
  4.  * For copying and distribution information, please see the file
  5.  * <copyright.h>.
  6.  */
  7.  
  8. #include <copyright.h>
  9. #include <stdio.h>
  10. #include <strings.h>
  11. #include <pwd.h>
  12.  
  13. #include <pcompat.h>
  14. #include <pauthent.h>
  15.  
  16. PAUTH
  17. get_pauth(type)
  18.     int        type;
  19.     {
  20.     static PAUTH_ST   no_auth_st;
  21.     static PAUTH          no_auth = NULL;
  22.  
  23.     struct passwd *whoiampw;
  24.  
  25.     if(no_auth == NULL) {
  26.         no_auth = &no_auth_st;
  27.         strcpy(no_auth->auth_type,"UNAUTHENTICATED");
  28.  
  29.         /* find out who we are */
  30.         DISABLE_PFS(whoiampw = getpwuid(getuid()));
  31.         if (whoiampw == 0) strcpy(no_auth->authenticator,"nobody");
  32.         else strcpy(no_auth->authenticator, whoiampw->pw_name);
  33.     }
  34.     return(no_auth);
  35.     }
  36.