return;
}
- a = create_user(username, 1);
+ a = create_user(username, CREATE_USER_BECOME_USER);
if (a == 0) {
logged_in_response();
extract_token(password, cmdbuf, 1, '|', sizeof password);
- a = create_user(username, 0);
+ a = create_user(username, CREATE_USER_DO_NOT_BECOME_USER);
if (a == 0) {
if (!IsEmptyStr(password)) {
}
/* The desired account name is available. Create the account and log it in! */
- if (create_user(nickname, 1)) return(6);
+ if (create_user(nickname, CREATE_USER_BECOME_USER)) return(6);
/* Generate a random password.
* The user doesn't care what the password is since he is using OpenID.
found_user = getuserbyuid(&CC->user, pd.pw_uid);
syslog(LOG_DEBUG, "user_ops: found it: uid=%ld, gecos=%s here: %d", (long)pd.pw_uid, pd.pw_gecos, found_user);
if (found_user != 0) {
- create_user(username, 0);
+ create_user(username, CREATE_USER_DO_NOT_BECOME_USER);
found_user = getuserbyuid(&CC->user, pd.pw_uid);
}
found_user = getuserbyuid(&CC->user, ldap_uid);
if (found_user != 0) {
- create_user(username, 0);
+ create_user(username, CREATE_USER_DO_NOT_BECOME_USER);
found_user = getuserbyuid(&CC->user, ldap_uid);
}
* create_user() - back end processing to create a new user
*
* Set 'newusername' to the desired account name.
- * Set 'become_user' to nonzero if this is self-service account creation and we want
- * to actually log in as the user we just created, otherwise set it to 0.
+ * Set 'become_user' to CREATE_USER_BECOME_USER if this is self-service account creation and we want
+ * to actually log in as the user we just created, otherwise set it to CREATE_USER_DO_NOT_BECOME_USER
*/
int create_user(const char *newusername, int become_user)
{
* creating a user, instead of doing self-service account creation
*/
- if (become_user) {
+ if (become_user == CREATE_USER_BECOME_USER) {
/* Now become the user we just created */
memcpy(&CC->user, &usbuf, sizeof(struct ctdluser));
safestrncpy(CC->curr_user, username, sizeof CC->curr_user);
void session_startup (void);
void logged_in_response(void);
int purge_user (char *pname);
+
int create_user (const char *newusername, int become_user);
+enum {
+ CREATE_USER_DO_NOT_BECOME_USER,
+ CREATE_USER_BECOME_USER
+};
+
void do_login(void);
int CtdlInvtKick(char *iuser, int op);
void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data),