X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Fvcard%2Fserv_vcard.c;fp=citadel%2Fmodules%2Fvcard%2Fserv_vcard.c;h=a86127fb42ad58f529e3e427eb0d2d45eb96eddc;hp=202c806e9d756b72451d26578fb1ab6e4766fdd7;hb=0475c981817d12900332693297a77a9ae7168129;hpb=30a4090b04dff1084df3789efe78afd1e2bf6d90 diff --git a/citadel/modules/vcard/serv_vcard.c b/citadel/modules/vcard/serv_vcard.c index 202c806e9..a86127fb4 100644 --- a/citadel/modules/vcard/serv_vcard.c +++ b/citadel/modules/vcard/serv_vcard.c @@ -2,7 +2,7 @@ * A server-side module for Citadel which supports address book information * using the standard vCard format. * - * Copyright (c) 1999-2012 by the citadel.org team + * Copyright (c) 1999-2015 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. @@ -73,10 +73,12 @@ * set global flag calling for an aide to validate new users */ void set_mm_valid(void) { + int flags = 0; + begin_critical_section(S_CONTROL); - get_control(); - CitControl.MMflags = CitControl.MMflags | MM_VALID ; - put_control(); + flags = CtdlGetConfigInt("MMflags"); + flags = flags | MM_VALID ; + CtdlSetConfigInt("MMflags", flags); end_critical_section(S_CONTROL); } @@ -385,7 +387,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg, recptypes *recp) { /* If users cannot create their own accounts, they cannot re-register either. */ if ( (yes_my_citadel_config) && - (config.c_disable_newu) && + (CtdlGetConfigInt("c_disable_newu")) && (CCC->user.axlevel < AxAideU) && (CCC->vcard_updated_by_ldap==0) ) { @@ -433,7 +435,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg, recptypes *recp) { /* Insert or replace RFC2739-compliant free/busy URL */ if (yes_my_citadel_config) { sprintf(buf, "http://%s/%s.vfb", - config.c_fqdn, + CtdlGetConfigStr("c_fqdn"), usbuf.fullname); for (i=0; buf[i]; ++i) { if (buf[i] == ' ') buf[i] = '_'; @@ -723,7 +725,7 @@ void cmd_regi(char *argbuf) { } /* If users cannot create their own accounts, they cannot re-register either. */ - if ( (config.c_disable_newu) && (CCC->user.axlevel < AxAideU) ) { + if ( (CtdlGetConfigInt("c_disable_newu")) && (CCC->user.axlevel < AxAideU) ) { cprintf("%d Self-service registration is not allowed here.\n", ERROR + HIGHER_ACCESS_REQUIRED); } @@ -865,7 +867,7 @@ void vcard_newuser(struct ctdluser *usbuf) { #ifdef HAVE_GETPWUID_R /* If using host auth mode, we add an email address based on the login */ - if (config.c_auth_mode == AUTHMODE_HOST) { + if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) { struct passwd pwd; char pwd_buffer[SIZ]; @@ -876,7 +878,7 @@ void vcard_newuser(struct ctdluser *usbuf) { syslog(LOG_DEBUG, "Searching for uid %d", usbuf->uid); if (getpwuid_r(usbuf->uid, &pwd, pwd_buffer, sizeof pwd_buffer, &result) == 0) { #endif // HAVE_GETPWUID_R - snprintf(buf, sizeof buf, "%s@%s", pwd.pw_name, config.c_fqdn); + snprintf(buf, sizeof buf, "%s@%s", pwd.pw_name, CtdlGetConfigStr("c_fqdn")); vcard_add_prop(v, "email;internet", buf); need_default_vcard=0; } @@ -889,7 +891,7 @@ void vcard_newuser(struct ctdluser *usbuf) { * Is this an LDAP session? If so, copy various LDAP attributes from the directory entry * into the user's vCard. */ - if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) { + if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) { //uid_t ldap_uid; int found_user; char ldap_cn[512]; @@ -907,7 +909,7 @@ void vcard_newuser(struct ctdluser *usbuf) { #endif if (need_default_vcard!=0) { /* Everyone gets an email address based on their display name */ - snprintf(buf, sizeof buf, "%s@%s", usbuf->fullname, config.c_fqdn); + snprintf(buf, sizeof buf, "%s@%s", usbuf->fullname, CtdlGetConfigStr("c_fqdn")); for (i=0; buf[i]; ++i) { if (buf[i] == ' ') buf[i] = '_'; } @@ -938,7 +940,7 @@ void vcard_purge(struct ctdluser *usbuf) { msg->cm_format_type = 0; CM_SetField(msg, eAuthor, usbuf->fullname, strlen(usbuf->fullname)); CM_SetField(msg, eOriginalRoom, HKEY(ADDRESS_BOOK_ROOM)); - CM_SetField(msg, eNodeName, CFG_KEY(c_nodename)); + CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename"))); CM_SetField(msg, eMesageText, HKEY("Purge this vCard\n")); len = snprintf(buf, sizeof buf, VCARD_EXT_FORMAT, @@ -1281,7 +1283,7 @@ void vcard_session_login_hook(void) { * Is this an LDAP session? If so, copy various LDAP attributes from the directory entry * into the user's vCard. */ - if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) { + if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) { v = vcard_get_user(&CCC->user); if (v) { if (Ctdl_LDAP_to_vCard(CCC->ldap_dn, v)) { @@ -1553,7 +1555,7 @@ CTDL_MODULE_INIT(vcard) } /* for postfix tcpdict */ - CtdlRegisterServiceHook(config.c_pftcpdict_port, /* Postfix */ + CtdlRegisterServiceHook(CtdlGetConfigInt("c_pftcpdict_port"), /* Postfix */ NULL, check_get_greeting, check_get,