summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-06-20 09:23:37 -0400
committerSimo Sorce <ssorce@redhat.com>2011-08-26 08:24:49 -0400
commitb4aab3d98d68bfa79323b216320b1d3dcc1941c9 (patch)
treec70d1cd61befcc8ea15df869abc86f7d5c7ea99b
parent672035cbbac649b74cbe2d8396466d18e3e81130 (diff)
downloadfreeipa-b4aab3d98d68bfa79323b216320b1d3dcc1941c9.tar.gz
freeipa-b4aab3d98d68bfa79323b216320b1d3dcc1941c9.tar.xz
freeipa-b4aab3d98d68bfa79323b216320b1d3dcc1941c9.zip
ipa-pwd-extop: Use common krb5 structs from kdb.h
This removes custom structures and allows easier sharing of code with ipa-kdb
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c2
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h9
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c14
-rw-r--r--daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c8
4 files changed, 14 insertions, 19 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c
index fe7cf972d..9ce497746 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipa_pwd_extop.c
@@ -93,7 +93,7 @@ static int filter_keys(struct ipapwd_krbcfg *krbcfg, struct ipapwd_keyset *kset)
for (i = 0; i < kset->num_keys; i++) {
for (j = 0; j < krbcfg->num_supp_encsalts; j++) {
if (kset->keys[i].ekey->type ==
- krbcfg->supp_encsalts[j].enc_type) {
+ krbcfg->supp_encsalts[j].ks_enctype) {
break;
}
}
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h
index ed9798829..904995eca 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h
@@ -97,20 +97,15 @@ struct ipapwd_operation {
/* from ipapwd_common.c */
-struct ipapwd_encsalt {
- krb5_int32 enc_type;
- krb5_int32 salt_type;
-};
-
struct ipapwd_krbcfg {
krb5_context krbctx;
char *realm;
int mkvno;
krb5_keyblock *kmkey;
int num_supp_encsalts;
- struct ipapwd_encsalt *supp_encsalts;
+ krb5_key_salt_tuple *supp_encsalts;
int num_pref_encsalts;
- struct ipapwd_encsalt *pref_encsalts;
+ krb5_key_salt_tuple *pref_encsalts;
char **passsync_mgrs;
int num_passsync_mgrs;
bool allow_lm_hash;
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 a4b4eb6af..93461e68d 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c
@@ -69,15 +69,15 @@ static const char *ipapwd_def_encsalts[] = {
static int new_ipapwd_encsalt(krb5_context krbctx,
const char * const *encsalts,
- struct ipapwd_encsalt **es_types,
+ krb5_key_salt_tuple **es_types,
int *num_es_types)
{
- struct ipapwd_encsalt *es;
+ krb5_key_salt_tuple *es;
int nes, i;
int rc;
for (i = 0; encsalts[i]; i++) /* count */ ;
- es = calloc(i + 1, sizeof(struct ipapwd_encsalt));
+ es = calloc(i + 1, sizeof(krb5_key_salt_tuple));
if (!es) {
LOG_OOM();
rc = LDAP_OPERATIONS_ERROR;
@@ -116,16 +116,16 @@ static int new_ipapwd_encsalt(krb5_context krbctx,
krberr = krb5_string_to_salttype(salt, &tmpsalt);
for (j = 0; j < nes; j++) {
- krb5_c_enctype_compare(krbctx, es[j].enc_type, tmpenc, &similar);
- if (similar && (es[j].salt_type == tmpsalt)) {
+ krb5_c_enctype_compare(krbctx, es[j].ks_enctype, tmpenc, &similar);
+ if (similar && (es[j].ks_salttype == tmpsalt)) {
break;
}
}
if (j == nes) {
/* not found */
- es[j].enc_type = tmpenc;
- es[j].salt_type = tmpsalt;
+ es[j].ks_enctype = tmpenc;
+ es[j].ks_salttype = tmpsalt;
nes++;
}
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c
index 6be02f9f1..3ce396099 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_encoding.c
@@ -319,7 +319,7 @@ static Slapi_Value **encrypt_encode_key(struct ipapwd_krbcfg *krbcfg,
salt.data = NULL;
- switch (krbcfg->pref_encsalts[i].salt_type) {
+ switch (krbcfg->pref_encsalts[i].ks_salttype) {
case KRB5_KDB_SALTTYPE_ONLYREALM:
@@ -396,14 +396,14 @@ static Slapi_Value **encrypt_encode_key(struct ipapwd_krbcfg *krbcfg,
default:
LOG_FATAL("Invalid salt type [%d]\n",
- krbcfg->pref_encsalts[i].salt_type);
+ krbcfg->pref_encsalts[i].ks_salttype);
goto enc_error;
}
/* need to build the key now to manage the AFS salt.length
* special case */
krberr = krb5_c_string_to_key(krbctx,
- krbcfg->pref_encsalts[i].enc_type,
+ krbcfg->pref_encsalts[i].ks_enctype,
&pwd, &salt, &key);
if (krberr) {
LOG_FATAL("krb5_c_string_to_key failed [%s]\n",
@@ -461,7 +461,7 @@ static Slapi_Value **encrypt_encode_key(struct ipapwd_krbcfg *krbcfg,
goto enc_error;
}
- kset->keys[i].salt->type = krbcfg->pref_encsalts[i].salt_type;
+ kset->keys[i].salt->type = krbcfg->pref_encsalts[i].ks_salttype;
if (salt.length) {
kset->keys[i].salt->value.bv_len = salt.length;