From b47f10709f910e8d709ebaa702249e3876298ad2 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 10 Mar 2004 04:18:22 +0000 Subject: [PATCH] * Improved NSS integration: if a user attempts to log in with a system account name, create the associated Citadel account if it doesn't exist. --- citadel/user_ops.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 2d343ae3c..b43c7bb2a 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -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)) { -- 2.39.2