get_pauth.c
上传用户:sddyfurun
上传日期:2007-01-04
资源大小:525k
文件大小:1k
源码类别:

代理服务器

开发平台:

Unix_Linux

  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. #include "pmachine.h"
  7. #include "pwd.h"
  8. #include "pcompat.h"
  9. #include "pauthent.h"
  10. PAUTH
  11. get_pauth(type)
  12.     int type;
  13.     {
  14. static PAUTH_ST   no_auth_st;
  15. static PAUTH   no_auth = NULL;
  16. struct passwd *whoiampw;
  17. if(no_auth == NULL) {
  18.     no_auth = &no_auth_st;
  19.     strcpy(no_auth->auth_type,"UNAUTHENTICATED");
  20.     /* find out who we are */
  21.     DISABLE_PFS(whoiampw = getpwuid(getuid()));
  22.     if (whoiampw == 0) strcpy(no_auth->authenticator,"nobody");
  23.     else strcpy(no_auth->authenticator, whoiampw->pw_name);
  24. }
  25. return(no_auth);
  26.     }