From: peter@ncrpda.curtin.edu.au (Peter N Lewis)
Subject: Re: help removing cap password prompt
Followup-To: comp.protocols.appletalk
Organization: NCRPDA, Curtin University
Date: Sun, 20 Dec 1992 11:12:47 GMT

In article <915@blue.cis.pitt.edu>, ebe+@pitt.edu (Elmer Beachley) wrote:

> How can I eliminate the password prompt when opening a unix connection?
> 
> I have a small network and have to give my Mac unix account a password
> because of CAP even tho I wouldn't have done this otherwise.

I'm not sure if this is what you're after, but others may find it useful, 
and it might give you somewhere to start.  I wanted all my users to have
the same CAP password, since our AppleShare network is secure, and I wanted
to auto mount their AppleShare volume, and have it stay mounted even if
they changed their unix password, so I did the following in afpos.c:

cap/applications/aufs/afpos.c:
#ifdef ULTRIX_SECURITY
      /* avoid evaluation order problem */
      crypted_password = ultrix_crypt(pwd, p);
      if (strcmp(crypted_password, p->pw_passwd) != 0) {
#else  ULTRIX_SECURITY
#ifdef NCRPDA
      if (p->pw_gid == 100) { /* Use standard password for group user */
        crypted_password = "abcdefghijklm";
      } else {
        crypted_password = p->pw_passwd;
      }
      if (strcmp(crypt(pwd,crypted_password),crypted_password) != 0) {
#else  NCRPDA
      if (strcmp(crypt(pwd,p->pw_passwd),p->pw_passwd) != 0) {
#endif NCRPDA
#endif ULTRIX_SECURITY

So all users with gid 100 get the standard password.  I can use
AppleShare's "Save name & password" option to have the user's directory
auto mounted on boot, and they don't have to worry about using the Chooser
to log in.

Full diffs follow (which also includes an option to force the username to
lowercase so it behaves the same as AppleShare volumes),
   Peter.

diff -c2 afpos.c.orig afpos.c
*** afpos.c.orig        Fri Oct 23 11:39:24 1992
--- afpos.c     Mon Oct 26 11:47:44 1992
***************
*** 1,6 ****
  /*
!  * $Author: djh $ $Date: 1992/07/14 11:30:17 $
!  * $Header: /mac/src/cap60/applications/aufs/RCS/afpos.c,v 2.27
1992/07/14 11:
30:17 djh Rel djh $
!  * $Revision: 2.27 $
   */

--- 1,6 ----
  /*
!  * $Author: djh $ $Date: 1992/08/01 13:05:17 $
!  * $Header: /mac/src/cap60/applications/aufs/RCS/afpos.c,v 2.28
1992/08/01 13:
05:17 djh Rel djh $
!  * $Revision: 2.28 $
   */

***************
*** 33,36 ****
--- 33,40 ----
   * POSSIBLE DEFINES:
   *
+  *  NCRPDA
+  *    Use stupid passwords instead of real ones to simplify maintenance
+  *    and keep passwds seperate from unix ones.  NCRPDA is incompatible
+  *    with ULTRIX_SECURITY
   *  NONLXLATE
   *   Define to turn off translation of \n to \r on line at a time
***************
*** 53,56 ****
--- 57,62 ----
   *
   *  PERMISSIVE_USER_NAME - let the Chooser name be from the gcos field
+  *  FORCE_LOWER_NAME - force the input name to lowercase (incompatible
+  *    with PERMISSIVE_USER_NAME, which superseeds it)
   *
   *  aux has a couple of "ifdefs".
***************
*** 70,73 ****
--- 76,83 ----
  */

+ /* I'm sure this should be somewhere else, like m4.features or something
*/
+ #define NCRPDA
+ #define FORCE_LOWER_NAME
+
  #include <stdio.h>
  #include <pwd.h>
***************
*** 82,86 ****
  #include <sys/ndir.h>
  #else xenix5
! #include <sys/dir.h>
  #endif xenix5
  #include <sys/stat.h>
--- 92,98 ----
  #include <sys/ndir.h>
  #else xenix5
! # ifndef drsnx
! #  include <sys/dir.h>
! # endif drsnx
  #endif xenix5
  #include <sys/stat.h>
***************
*** 165,168 ****
--- 177,186 ----
  #endif USEGETMNT

+ #ifdef drsnx
+ # ifdef USESTATFS
+ #  undef USESTATFS    /* ICL DRS/NX statfs() is a little different */
+ # endif USESTATFS
+ #endif drsnx
+
  #include <netat/afp.h>
  #include <netat/afpcmd.h>             /* flags should be in misc  */
***************
*** 183,186 ****
--- 201,207 ----
  #include <ctype.h>
  #endif PERMISSIVE_USER_NAME
+ #ifdef FORCE_LOWER_NAME
+ #include <ctype.h>
+ #endif FORCE_LOWER_NAME

  #ifdef ULTRIX_SECURITY
***************
*** 3055,3058 ****
--- 3076,3083 ----
    char *ultrix_crypt();
    char *crypted_password;
+ #else  ULTRIX_SECURITY
+ #ifdef NCRPDA
+   char *crypted_password;
+ #endif NCRPDA
  #endif ULTRIX_SECURITY
  #ifdef LWSRV_AUFS_SECURITY
***************
*** 3060,3063 ****
--- 3085,3091 ----
    int namlen;
  #endif LWSRV_AUFS_SECURITY
+ #ifdef FORCE_LOWER_NAME
+   int i;
+ #endif FORCE_LOWER_NAME
    extern int nousrvol;

***************
*** 3064,3067 ****
--- 3092,3103 ----
    safedebug = (DBOSI || (getuid() != 0 && geteuid() != 0));

+ #ifdef FORCE_LOWER_NAME
+   if (uam != UAM_ANON) {
+     for (i = 0 ; nam[i] ; i++)
+       if (isupper(nam[i]))
+         nam[i] = tolower(nam[i]);
+   }
+ #endif
+
    logit(0,"Login requested for %s (we are %srunning as root)",
        (uam == UAM_ANON) ? "<anonymous>" : nam,
***************
*** 3152,3156 ****
--- 3188,3201 ----
        if (strcmp(crypted_password, p->pw_passwd) != 0) {
  #else  ULTRIX_SECURITY
+ #ifdef NCRPDA
+       if (p->pw_gid == 100) { /* Use standard password for group user */
+         crypted_password = "abcdefghijklm";
+       } else {
+         crypted_password = p->pw_passwd;
+       }
+       if (strcmp(crypt(pwd,crypted_password),crypted_password) != 0) {
+ #else  NCRPDA
        if (strcmp(crypt(pwd,p->pw_passwd),p->pw_passwd) != 0) {
+ #endif NCRPDA
  #endif ULTRIX_SECURITY
        logit(0,"Login: Incorrect password for user %s",nam);


_______________________________________________________________________
Peter N Lewis <peter@ncrpda.curtin.edu.au>           Ph: +61 9 368 2055