From 64e64bd07889e2d51e5d4bcf555fb46122bdf9f2 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Thu, 21 Feb 2013 00:27:10 +0100 Subject: [PATCH] OPENID: if self service account creation is disabled - ApenID is also. --- citadel/citserver.c | 4 ++- citadel/modules/openid/serv_openid_rp.c | 37 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/citadel/citserver.c b/citadel/citserver.c index 761947375..d91b976b0 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -279,7 +279,9 @@ void cmd_info(char *cmdbuf) { cprintf("0\n"); /* 1 = no, this server is not LDAP-enabled */ #endif - if (config.c_auth_mode == AUTHMODE_NATIVE) { + if ((config.c_auth_mode == AUTHMODE_NATIVE) && + (config.c_disable_newu == 0)) + { cprintf("%d\n", config.c_disable_newu); } else { diff --git a/citadel/modules/openid/serv_openid_rp.c b/citadel/modules/openid/serv_openid_rp.c index ecb4ef387..d43448d8d 100644 --- a/citadel/modules/openid/serv_openid_rp.c +++ b/citadel/modules/openid/serv_openid_rp.c @@ -211,7 +211,14 @@ void cmd_oidl(char *argbuf) { struct cdbdata *cdboi; long usernum = 0L; + if (config.c_disable_newu) + { + cprintf("%d this system does not support openid.\n", + ERROR + CMD_NOT_SUPPORTED); + return; + } if (CtdlAccessCheck(ac_logged_in)) return; + cdb_rewind(CDB_OPENID); cprintf("%d Associated OpenIDs:\n", LISTING_FOLLOWS); @@ -236,6 +243,12 @@ void cmd_oida(char *argbuf) { long usernum; struct ctdluser usbuf; + if (config.c_disable_newu) + { + cprintf("%d this system does not support openid.\n", + ERROR + CMD_NOT_SUPPORTED); + return; + } if (CtdlAccessCheck(ac_aide)) return; cdb_rewind(CDB_OPENID); cprintf("%d List of all OpenIDs in the database:\n", LISTING_FOLLOWS); @@ -265,6 +278,12 @@ void cmd_oida(char *argbuf) { void cmd_oidc(char *argbuf) { ctdl_openid *oiddata = (ctdl_openid *) CC->openid_data; + if (config.c_disable_newu) + { + cprintf("%d this system does not support openid.\n", + ERROR + CMD_NOT_SUPPORTED); + return; + } if ( (!oiddata) || (!oiddata->verified) ) { cprintf("%d You have not verified an OpenID yet.\n", ERROR); return; @@ -292,6 +311,12 @@ void cmd_oidd(char *argbuf) { int this_is_mine = 0; long usernum = 0L; + if (config.c_disable_newu) + { + cprintf("%d this system does not support openid.\n", + ERROR + CMD_NOT_SUPPORTED); + return; + } if (CtdlAccessCheck(ac_logged_in)) return; extract_token(id_to_detach, argbuf, 0, '|', sizeof id_to_detach); if (IsEmptyStr(id_to_detach)) { @@ -807,6 +832,12 @@ void cmd_oids(char *argbuf) { ctdl_openid *oiddata; int discovery_succeeded = 0; + if (config.c_disable_newu) + { + cprintf("%d this system does not support openid.\n", + ERROR + CMD_NOT_SUPPORTED); + return; + } Free_ctdl_openid ((ctdl_openid**)&CCC->openid_data); CCC->openid_data = oiddata = malloc(sizeof(ctdl_openid)); @@ -932,6 +963,12 @@ void cmd_oidf(char *argbuf) { void *Value; ctdl_openid *oiddata = (ctdl_openid *) CC->openid_data; + if (config.c_disable_newu) + { + cprintf("%d this system does not support openid.\n", + ERROR + CMD_NOT_SUPPORTED); + return; + } if (oiddata == NULL) { cprintf("%d run OIDS first.\n", ERROR + INTERNAL_ERROR); return; -- 2.30.2