-/*
- * Server functions which perform operations on user objects.
- *
- * Copyright (c) 1987-2020 by the citadel.org team
- *
- * This program is open source software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License, version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// Server functions which perform operations on user objects.
+//
+// Copyright (c) 1987-2021 by the citadel.org team
+//
+// This program is open source software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License, version 3.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
#include <stdlib.h>
#include <unistd.h>
}
makeuserkey(usernamekey, name);
+ if (IsEmptyStr(usernamekey)) {
+ return(1); // empty user name
+ }
cdbus = cdb_fetch(CDB_USERS, usernamekey, strlen(usernamekey));
- if (cdbus == NULL) { /* user not found */
+ if (cdbus == NULL) { // user not found
return(1);
}
if (usbuf != NULL) {
}
-#ifdef HAVE_LDAP
else if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
/* LDAP auth mode */
}
}
-#endif
else {
/* native auth mode */
- recptypes *valid = NULL;
+ struct recptypes *valid = NULL;
/* First, try to log in as if the supplied name is a display name */
found_user = CtdlGetUser(&CC->user, username);
CtdlPutUserLock(&CC->user);
/* If we are using LDAP authentication, extract the user's email addresses from the directory. */
-#ifdef HAVE_LDAP
if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
char new_emailaddrs[512];
if (CtdlGetConfigInt("c_ldap_sync_email_addrs") > 0) {
}
}
}
-#endif
/* If the user does not have any email addresses assigned, generate one. */
if (IsEmptyStr(CC->user.emailaddrs)) {
}
/* Populate the user principal identity, which is consistent and never aliased */
- strcpy(CC->cs_principal_id, "wowowowow");
+ strcpy(CC->cs_principal_id, "");
makeuserkey(CC->cs_principal_id, CC->user.fullname);
strcat(CC->cs_principal_id, "@");
strcat(CC->cs_principal_id, CtdlGetConfigStr("c_fqdn"));
}
}
-#ifdef HAVE_LDAP
else if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
/* LDAP auth mode */
code = (-1);
}
}
-#endif
else {