Cosmetic changes to fix code style and LDAP attribute descriptions. -- Simo Sorce * Red Hat, Inc * New York
>From d89e2d07e7b306b95cafb27e9cf355fa3835d1cc Mon Sep 17 00:00:00 2001 From: Simo Sorce <sso...@redhat.com> Date: Fri, 1 Oct 2010 12:29:05 -0400 Subject: [PATCH 2/6] pwd-plugin: format/style changes
Use __func__ in log functions instead of the explicit function name so that if the function need to be renamed later logs reflect the change automatically w/o the need to change all occurrences. Also makes a grep for the function name less noisy avoiding tons of false positives. --- .../ipa-pwd-extop/ipapwd_common.c | 51 +++++++++----------- 1 files changed, 23 insertions(+), 28 deletions(-) diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c index b1826db..0e08785 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c @@ -157,28 +157,26 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) config = calloc(1, sizeof(struct ipapwd_krbcfg)); if (!config) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", - "Out of memory!\n"); + slapi_log_error(SLAPI_LOG_FATAL, __func__, "Out of memory!\n"); goto free_and_error; } kmkey = calloc(1, sizeof(krb5_keyblock)); if (!kmkey) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", - "Out of memory!\n"); + slapi_log_error(SLAPI_LOG_FATAL, __func__, "Out of memory!\n"); goto free_and_error; } config->kmkey = kmkey; krberr = krb5_init_context(&config->krbctx); if (krberr) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", + slapi_log_error(SLAPI_LOG_FATAL, __func__, "krb5_init_context failed\n"); goto free_and_error; } ret = krb5_get_default_realm(config->krbctx, &config->realm); if (ret) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", + slapi_log_error(SLAPI_LOG_FATAL, __func__, "Failed to get default realm?!\n"); goto free_and_error; } @@ -186,8 +184,7 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) /* get the Realm Container entry */ ret = ipapwd_getEntry(ipa_realm_dn, &realm_entry, NULL); if (ret != LDAP_SUCCESS) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", - "No realm Entry?\n"); + slapi_log_error(SLAPI_LOG_FATAL, __func__, "No realm Entry?\n"); goto free_and_error; } @@ -195,36 +192,33 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) ret = slapi_entry_attr_find(realm_entry, "krbMKey", &a); if (ret == -1) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", - "No master key??\n"); + slapi_log_error(SLAPI_LOG_FATAL, __func__, "No master key??\n"); goto free_and_error; } /* there should be only one value here */ ret = slapi_attr_first_value(a, &v); if (ret == -1) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", - "No master key??\n"); + slapi_log_error(SLAPI_LOG_FATAL, __func__, "No master key??\n"); goto free_and_error; } bval = slapi_value_get_berval(v); if (!bval) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", + slapi_log_error(SLAPI_LOG_FATAL, __func__, "Error retrieving master key berval\n"); goto free_and_error; } be = ber_init(bval); if (!bval) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", - "ber_init() failed!\n"); + slapi_log_error(SLAPI_LOG_FATAL, __func__, "ber_init() failed!\n"); goto free_and_error; } tag = ber_scanf(be, "{i{iO}}", &tmp, &ttype, &mkey); if (tag == LBER_ERROR) { - slapi_log_error(SLAPI_LOG_TRACE, "ipapwd_getConfig", + slapi_log_error(SLAPI_LOG_TRACE, __func__, "Bad Master key encoding ?!\n"); goto free_and_error; } @@ -234,8 +228,7 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) kmkey->length = mkey->bv_len; kmkey->contents = malloc(mkey->bv_len); if (!kmkey->contents) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", - "Out of memory!\n"); + slapi_log_error(SLAPI_LOG_FATAL, __func__, "Out of memory!\n"); goto free_and_error; } memcpy(kmkey->contents, mkey->bv_val, mkey->bv_len); @@ -246,7 +239,8 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) /*** get the Supported Enc/Salt types ***/ - encsalts = slapi_entry_attr_get_charray(realm_entry, "krbSupportedEncSaltTypes"); + encsalts = slapi_entry_attr_get_charray(realm_entry, + "krbSupportedEncSaltTypes"); if (encsalts) { ret = new_ipapwd_encsalt(config->krbctx, (const char * const *)encsalts, @@ -254,7 +248,7 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) &config->num_supp_encsalts); slapi_ch_array_free(encsalts); } else { - slapi_log_error(SLAPI_LOG_TRACE, "ipapwd_getConfig", + slapi_log_error(SLAPI_LOG_TRACE, __func__, "No configured salt types use defaults\n"); ret = new_ipapwd_encsalt(config->krbctx, ipapwd_def_encsalts, @@ -262,14 +256,15 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) &config->num_supp_encsalts); } if (ret) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", + slapi_log_error(SLAPI_LOG_FATAL, __func__, "Can't get Supported EncSalt Types\n"); goto free_and_error; } /*** get the Preferred Enc/Salt types ***/ - encsalts = slapi_entry_attr_get_charray(realm_entry, "krbDefaultEncSaltTypes"); + encsalts = slapi_entry_attr_get_charray(realm_entry, + "krbDefaultEncSaltTypes"); if (encsalts) { ret = new_ipapwd_encsalt(config->krbctx, (const char * const *)encsalts, @@ -277,7 +272,7 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) &config->num_pref_encsalts); slapi_ch_array_free(encsalts); } else { - slapi_log_error(SLAPI_LOG_TRACE, "ipapwd_getConfig", + slapi_log_error(SLAPI_LOG_TRACE, __func__, "No configured salt types use defaults\n"); ret = new_ipapwd_encsalt(config->krbctx, ipapwd_def_encsalts, @@ -285,7 +280,7 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) &config->num_pref_encsalts); } if (ret) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", + slapi_log_error(SLAPI_LOG_FATAL, __func__, "Can't get Preferred EncSalt Types\n"); goto free_and_error; } @@ -295,17 +290,17 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void) /* get the Realm Container entry */ ret = ipapwd_getEntry(ipa_pwd_config_dn, &config_entry, NULL); if (ret != LDAP_SUCCESS) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", + slapi_log_error(SLAPI_LOG_FATAL, __func__, "No config Entry? Impossible!\n"); goto free_and_error; } - config->passsync_mgrs = slapi_entry_attr_get_charray(config_entry, "passSyncManagersDNs"); + config->passsync_mgrs = + slapi_entry_attr_get_charray(config_entry, "passSyncManagersDNs"); /* now add Directory Manager, it is always added by default */ tmpstr = slapi_ch_strdup("cn=Directory Manager"); slapi_ch_array_add(&config->passsync_mgrs, tmpstr); if (config->passsync_mgrs == NULL) { - slapi_log_error(SLAPI_LOG_FATAL, "ipapwd_getConfig", - "Out of memory!\n"); + slapi_log_error(SLAPI_LOG_FATAL, __func__, "Out of memory!\n"); goto free_and_error; } for (i = 0; config->passsync_mgrs[i]; i++) /* count */ ; -- 1.7.2.3
>From 297bc028b7145c5072b2223b8686ac2646dbf313 Mon Sep 17 00:00:00 2001 From: Simo Sorce <sso...@redhat.com> Date: Mon, 4 Oct 2010 13:33:18 -0400 Subject: [PATCH 3/6] Fix descriptions --- install/share/60basev2.ldif | 2 +- install/share/60sudo.ldif | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/install/share/60basev2.ldif b/install/share/60basev2.ldif index b4ad102..5e97f13 100644 --- a/install/share/60basev2.ldif +++ b/install/share/60basev2.ldif @@ -25,7 +25,7 @@ attributeTypes: (2.16.840.1.113730.3.8.3.19 NAME 'serviceCategory' DESC 'Additio attributeTypes: (2.16.840.1.113730.3.8.3.20 NAME 'memberService' DESC 'Reference to the pam service of this operation.' SUP distinguishedName EQUALITY distinguishedNameMatch ORDERING distinguishedNameMatch SUBSTR distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'IPA v2' ) attributeTypes: (2.16.840.1.113730.3.8.3.9 NAME 'ipaEnabledFlag' DESC 'The flag to show if the association is active or should be ignored' EQUALITY booleanMatch ORDERING booleanMatch SUBSTR booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE X-ORIGIN 'IPA v2' ) objectClasses: (2.16.840.1.113730.3.8.4.6 NAME 'ipaAssociation' ABSTRACT MUST ( ipaUniqueID $ cn ) MAY ( memberUser $ userCategory $ memberHost $ hostCategory $ ipaEnabledFlag $ description ) X-ORIGIN 'IPA v2' ) -attributeTypes: (2.16.840.1.113730.3.8.3.10 NAME 'sourceHost' DESC 'Link to the host or group of hosts' SUP memberHost SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'IPA v2' ) +attributeTypes: (2.16.840.1.113730.3.8.3.10 NAME 'sourceHost' DESC 'Link to a host or group of hosts' SUP memberHost SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'IPA v2' ) attributeTypes: (2.16.840.1.113730.3.8.3.11 NAME 'externalHost' DESC 'Multivalue string attribute that allows storing host names.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'IPA v2' ) attributeTypes: (2.16.840.1.113730.3.8.3.12 NAME 'sourceHostCategory' DESC 'Additional classification for hosts' EQUALITY caseIgnoreMatch ORDERING caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'IPA v2' ) attributeTypes: (2.16.840.1.113730.3.8.3.13 NAME 'accessRuleType' DESC 'The flag to represent if it is allow or deny rule.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'IPA v2' ) diff --git a/install/share/60sudo.ldif b/install/share/60sudo.ldif index 0f3ac03..2cd8e0c 100644 --- a/install/share/60sudo.ldif +++ b/install/share/60sudo.ldif @@ -6,7 +6,7 @@ dn: cn=schema ## ObjectClasses: 2.16.840.1.113730.3.8.8.x ## ## Attribute to store DN of a SUDO command or a group of SUDO commands -attributetypes: (2.16.840.1.113730.3.8.7.1 NAME 'memberCmd' DESC 'Reference to a command or group of the commands.' SUP distinguishedName EQUALITY distinguishedNameMatch ORDERING distinguishedNameMatch SUBSTR distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'IPA v2' ) +attributetypes: (2.16.840.1.113730.3.8.7.1 NAME 'memberCmd' DESC 'Reference to a command or group of commands.' SUP distinguishedName EQUALITY distinguishedNameMatch ORDERING distinguishedNameMatch SUBSTR distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'IPA v2' ) ## Attribute to store command category attributeTypes: (2.16.840.1.113730.3.8.7.2 NAME 'cmdCategory' DESC 'Additional classification for commands' EQUALITY caseIgnoreMatch ORDERING caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'IPA v2' ) ## Attribute to store user not managed by the central server -- 1.7.2.3
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel