Patch #: 22 Type: operational change Priority: none Modification: allow AUFS login name to be real name or login name Submitted: Jean-Luc Mounier Archived: munnari.OZ.AU mac/cap.patches/cap60.patch022 Summary: try to match supplied name against password gcos field File: cap60/applications/aufs/afpos.c File: cap60/Configure *** applications/aufs/afpos.c.orig Tue May 28 20:33:37 1991 --- applications/aufs/afpos.c Tue May 28 20:35:00 1991 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 1991/05/20 12:54:11 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/afpos.c,v 2.5 1991/05/20 12:54:11 djh Exp djh $ ! * $Revision: 2.5 $ */ /* --- 1,7 ---- /* ! * $Author: djh $ $Date: 1991/05/28 10:34:46 $ ! * $Header: /local/mulga/mac/src/cap60/applications/aufs/RCS/afpos.c,v 2.7 1991/05/28 10:34:46 djh Exp djh $ ! * $Revision: 2.7 $ */ /* *************** *** 17,22 **** --- 17,24 ---- * March 1987 Schilit Created. * March 1988 CCKIM cleanup * December 1990 djh tidy up for AFP 2.0 + * May 1991 ber,jlm accept a part of the gcos or login name + * (PERMISSIVE_USER_NAME) * */ *************** *** 49,54 **** --- 51,58 ---- * how much is free and we need both * USESTATFS - statfs is the Sun NFS solution to volume information. * + * PERMISSIVE_USER_NAME - let the Chooser name be from the gcos field + * * aux has a couple of "ifdefs". * - one to set full BSD compatibility * - one to protect against rename("file1","file1"): it will *************** *** 166,171 **** --- 170,179 ---- #include "sizeserver.h" #endif SIZESERVER + #ifdef PERMISSIVE_USER_NAME + #include + #endif PERMISSIVE_USER_NAME + #ifdef MAXBSIZE # define IOBSIZE MAXBSIZE /* set to max buf entry size by if there */ #else *************** *** 2754,2759 **** --- 2762,2862 ---- return(aeParamErr); } + #ifdef PERMISSIVE_USER_NAME + /* + * allow the specified user name to be + * from the gcos field of the passwd file + * IE: Chooser names don't have to be login names + */ + static struct passwd * + getpwgnam(nam) + char *nam; + { + char *ptm; + char nom[40]; + char nomi[200]; + struct passwd *pw; + int match, i, j; + + /* map to lower case, translate some special characters */ + + for (i = 0 ; nam[i] ; i++) { + switch (nam[i]) { + case 0x8d: + nom[i] = 'c'; + break; + case 0x8e: + case 0x8f: + case 0x90: + case 0x91: + nom[i] = 'e'; + break; + case 0x92: + case 0x93: + case 0x94: + case 0x95: + nom[i] = 'i'; + break; + case 0x96: + nom[i] = 'n'; + break; + case 0x97: + case 0x98: + case 0x99: + case 0x9a: + case 0x9b: + nom[i] = 'o'; + break; + case 0x9c: + case 0x9d: + case 0x9e: + case 0x9f: + nom[i] = 'u'; + break; + default: + if (isupper(nam[i])) + nom[i] = tolower(nam[i]); + else + nom[i] = nam[i]; + break; + } + } + nom[i] = '\0'; + setpwent(); + while ((pw = getpwent()) != 0) { + ptm = pw->pw_gecos; + for (i = 0 ; *ptm ; ptm++, i++) { + if (isupper(*ptm)) + nomi[i] = tolower(*ptm); + else + nomi[i] = *ptm; + } + nomi[i] = '\0'; + for (match=i=j=0 ; ((nom[j] != 0) && (nomi[i] != 0)) ; ) { + if (nomi[i] == nom[j]) { + if (match == 0) + match = i+1; + j++; + i++; + } else { + if (match != 0) { + i = match; + match = 0; + j = 0; + } else + i++; + } + } + if (nom[j] == '\0') { /* found it */ + endpwent(); + return(pw); + } + } + endpwent(); + return(NILPWD); + } + #endif PERMISSIVE_USER_NAME + export OSErr OSLogin(nam,pwd,pwdother,uam) char *nam,*pwd; *************** *** 2838,2843 **** --- 2941,2952 ---- case UAM_CLEAR: if (!apasswdfile) { p = (struct passwd *) getpwnam(nam); /* user name */ + #ifdef PERMISSIVE_USER_NAME + if (p == NILPWD) { + if ((p = (struct passwd *) getpwgnam(nam)) != NILPWD) /* gcos name */ + logit(0, "Login: mapping \"%s\" to login name %s", nam, p->pw_name); + } + #endif PERMISSIVE_USER_NAME if (p == NILPWD) { logit(0,"Login: Unknown user %s",nam); return(aeParamErr); /* unknown user */ *** Configure.orig Tue May 28 16:33:13 1991 --- Configure Tue May 28 16:28:38 1991 *************** *** 1,7 **** #!/bin/sh ! # $Author: djh $ $Date: 1991/05/20 08:31:35 $ ! # $Header: /mac/src/cap60/RCS/Configure,v 2.5 1991/05/20 08:31:35 djh Exp djh $ ! # $Revision: 2.5 $ # CAP configuration shell script. This ain't perfect, but it's a start. # Execute with /bin/sh Configure if your system won't run it (ksh is okay too) # --- 1,7 ---- #!/bin/sh ! # $Author: djh $ $Date: 1991/05/28 06:10:31 $ ! # $Header: /mac/src/cap60/RCS/Configure,v 2.7 1991/05/28 06:10:31 djh Exp $ ! # $Revision: 2.7 $ # CAP configuration shell script. This ain't perfect, but it's a start. # Execute with /bin/sh Configure if your system won't run it (ksh is okay too) # *************** *** 435,440 **** --- 435,443 ---- # # + USE_HOST_ICON provides automatic aufs ICON selection on supported hosts # define(`specialcflags',concat(specialcflags,` -DUSE_HOST_ICON')) + # + # + PERMISSIVE_USER_NAME allows AUFS users to have their real name in Chooser + # define(`specialcflags',concat(specialcflags,` -DPERMISSIVE_USER_NAME')) # EOT0 result=0 *** README.orig Tue May 28 16:17:42 1991 --- README Tue May 28 16:18:37 1991 *************** *** 3,9 **** (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 21, May 1991 Introduction ------------ --- 3,9 ---- (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 22, May 1991 Introduction ------------