home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1989, 1990 by the University of Washington
- *
- * For copying and distribution information, please see the file
- * <copyright.h>.
- *
- * v1.2.1 - 09/17/91 (bpk) - added BULL & USG stuff, thanks to Jim Sillas
- * v1.2.0 - 09/17/91 (bpk) - fixed it up (thanks to synful)
- * v1.1.1 - 08/30/91 (bpk) - added VMS support
- */
-
- #include <copyright.h>
- #include <stdio.h>
- #ifndef VMS
- # include <sys/types.h>
- #endif
-
- #if defined(USG) || defined(UTS) || defined(_AIX)
- # include <string.h>
- #else
- # include <strings.h>
- #endif
-
- #ifndef VMS
- # include <pwd.h>
- #else
- # include <jpidef.h>
- #endif
-
- #include <pcompat.h>
- #include <pauthent.h>
-
- PAUTH
- get_pauth(type)
- int type;
- {
- static PAUTH_ST no_auth_st;
- static PAUTH no_auth = NULL;
- #ifndef VMS
- struct passwd *whoiampw;
- #else
- char username[13];
- unsigned short usernamelen;
- struct {
- unsigned short buflen;
- unsigned short itmcod;
- char *bufadr;
- unsigned short *retlenadr;
- unsigned long null;
- } jpi_itemlist;
- #endif
-
- if(no_auth == NULL) {
- no_auth = &no_auth_st;
- strcpy(no_auth->auth_type,"UNAUTHENTICATED");
-
- /* find out who we are */
- #ifndef VMS
- DISABLE_PFS(whoiampw = getpwuid(getuid()));
- if (whoiampw == 0) strcpy(no_auth->authenticator,"nobody");
- else strcpy(no_auth->authenticator, whoiampw->pw_name);
- #else
- jpi_itemlist.buflen = sizeof(username);
- jpi_itemlist.itmcod = JPI$_USERNAME;
- jpi_itemlist.bufadr = &username;
- jpi_itemlist.retlenadr = &usernamelen;
- jpi_itemlist.null = 0;
- if (SYS$GETJPI(0, 0, 0, &jpi_itemlist, 0, 0, 0) & 0x1)
- {
- username[usernamelen] = 0;
- strcpy(no_auth->authenticator, username);
- } else
- strcpy(no_auth->authenticator, "nobody");
- #endif
- }
- return(no_auth);
- }
-