* Improved NSS integration: if a user attempts to log in with a system
authorArt Cancro <ajc@citadel.org>
Wed, 10 Mar 2004 04:18:22 +0000 (04:18 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 10 Mar 2004 04:18:22 +0000 (04:18 +0000)
  account name, create the associated Citadel account if it doesn't exist.

citadel/user_ops.c

index 2d343ae3caff32ce59a32f56ef97fbd4c63a2f2f..b43c7bb2af46a9b7833f49e645b3c90e54834ec3 100644 (file)
@@ -352,6 +352,7 @@ int CtdlLoginExistingUser(char *trythisname)
        char username[SIZ];
        int found_user;
        struct recptypes *valid = NULL;
+       struct passwd *p = NULL;
 
        if (trythisname == NULL) return login_not_found;
        safestrncpy(username, trythisname, sizeof username);
@@ -378,6 +379,20 @@ int CtdlLoginExistingUser(char *trythisname)
                }
        }
 
+#ifdef ENABLE_AUTOLOGIN
+       /* If we haven't found the account yet, and the supplied name
+        * is a login name on the underlying host system, create the
+        * account.
+        */
+       if (found_user != 0) {
+               p = (struct passwd *) getpwnam(username);
+               if (p != NULL) {
+                       create_user(username, 0);
+                       found_user = getuser(&CC->user, username);
+               }
+       }
+#endif /* ENABLE_AUTOLOGIN */
+
        /* Did we find something? */
        if (found_user == 0) {
                if (((CC->nologin)) && (CC->user.axlevel < 6)) {