svn rev #24214: branches/plugins2/ pwqual_combo/ src/include/krb5/ src/lib/kadm5/srv/ ...

ghudson@MIT.EDU ghudson at MIT.EDU
Mon Jul 26 18:16:56 EDT 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=24214
Commit By: ghudson
Log Message:
In the plugins2 branch, untabify new files which accidentally used
tabs in indentation.



Changed Files:
U   branches/plugins2/pwqual_combo/combo.c
U   branches/plugins2/src/include/krb5/pwqual_plugin.h
U   branches/plugins2/src/lib/kadm5/srv/pwqual.c
U   branches/plugins2/src/lib/kadm5/srv/pwqual_dict.c
U   branches/plugins2/src/lib/kadm5/srv/pwqual_policy.c
U   branches/plugins2/src/lib/krb5/krb/plugin.c
Modified: branches/plugins2/pwqual_combo/combo.c
===================================================================
--- branches/plugins2/pwqual_combo/combo.c	2010-07-26 22:14:21 UTC (rev 24213)
+++ branches/plugins2/pwqual_combo/combo.c	2010-07-26 22:16:56 UTC (rev 24214)
@@ -106,7 +106,7 @@
 
 static krb5_error_code
 combo_open(krb5_context context, const char *dict_file,
-	   krb5_pwqual_moddata *data)
+           krb5_pwqual_moddata *data)
 {
     krb5_error_code ret;
     combo_moddata dict;
@@ -134,28 +134,28 @@
 
 static krb5_error_code
 combo_check(krb5_context context, krb5_pwqual_moddata data,
-	    const char *password, kadm5_policy_ent_t policy,
-	    krb5_principal princ)
+            const char *password, kadm5_policy_ent_t policy,
+            krb5_principal princ)
 {
     combo_moddata dict = (combo_moddata)data;
     size_t i, j, len, pwlen;
     const char *remainder;
 
     if (dict->word_list == NULL)
-	return 0;
+        return 0;
 
     pwlen = strlen(password);
     for (i = 0; i < dict->word_count; i++) {
-	len = strlen(dict->word_list[i]);
-	if (len >= pwlen)
-	    continue;
-	if (strncasecmp(password, dict->word_list[i], len) != 0)
-	    continue;
-	remainder = password + len;
-	for (i = 0; i < dict->word_count; i++) {
-	    if (strcasecmp(remainder, dict->word_list[i]) == 0)
-		return KADM5_PASS_Q_DICT;
-	}
+        len = strlen(dict->word_list[i]);
+        if (len >= pwlen)
+            continue;
+        if (strncasecmp(password, dict->word_list[i], len) != 0)
+            continue;
+        remainder = password + len;
+        for (i = 0; i < dict->word_count; i++) {
+            if (strcasecmp(remainder, dict->word_list[i]) == 0)
+                return KADM5_PASS_Q_DICT;
+        }
     }
 
     return 0;

Modified: branches/plugins2/src/include/krb5/pwqual_plugin.h
===================================================================
--- branches/plugins2/src/include/krb5/pwqual_plugin.h	2010-07-26 22:14:21 UTC (rev 24213)
+++ branches/plugins2/src/include/krb5/pwqual_plugin.h	2010-07-26 22:16:56 UTC (rev 24214)
@@ -50,8 +50,8 @@
      * of the password policy given by policy.  Return an error if the password
      * check fails. */
     krb5_error_code (*check)(krb5_context context, krb5_pwqual_moddata data,
-			     const char *password, kadm5_policy_ent_t policy,
-			     krb5_principal princ);
+                             const char *password, kadm5_policy_ent_t policy,
+                             krb5_principal princ);
 
     /* Optional: Release resources used by module data. */
     void (*close)(krb5_context context, krb5_pwqual_moddata data);

Modified: branches/plugins2/src/lib/kadm5/srv/pwqual.c
===================================================================
--- branches/plugins2/src/lib/kadm5/srv/pwqual.c	2010-07-26 22:14:21 UTC (rev 24213)
+++ branches/plugins2/src/lib/kadm5/srv/pwqual.c	2010-07-26 22:16:56 UTC (rev 24214)
@@ -47,26 +47,26 @@
 
     ret = k5_plugin_load_all(context, PLUGIN_INTERFACE_PWQUAL, &modules);
     if (ret != 0)
-	goto cleanup;
+        goto cleanup;
 
     /* Allocate a large enough list of handles. */
     for (count = 0; modules[count] != NULL; count++);
     list = k5alloc((count + 1) * sizeof(*list), &ret);
     if (list == NULL)
-	goto cleanup;
+        goto cleanup;
 
     /* For each module, allocate a handle and initialize its vtable.  Skip
      * modules which don't successfully initialize. */
     count = 0;
     for (mod = modules; *mod != NULL; mod++) {
-	handle = k5alloc(sizeof(*handle), &ret);
-	if (handle == NULL)
-	    goto cleanup;
-	ret = (*mod)(context, 1, 1, (krb5_plugin_vtable)&handle->vt);
-	if (ret == 0)
-	    list[count++] = handle;
-	else
-	    free(handle);
+        handle = k5alloc(sizeof(*handle), &ret);
+        if (handle == NULL)
+            goto cleanup;
+        ret = (*mod)(context, 1, 1, (krb5_plugin_vtable)&handle->vt);
+        if (ret == 0)
+            list[count++] = handle;
+        else
+            free(handle);
     }
 
     *handles = list;
@@ -91,7 +91,7 @@
                const char *dict_file)
 {
     if (handle->data != NULL)
-	return EINVAL;
+        return EINVAL;
     if (handle->vt.open == NULL)
         return 0;
     return handle->vt.open(context, dict_file, &handle->data);
@@ -99,8 +99,8 @@
 
 krb5_error_code
 k5_pwqual_check(krb5_context context, pwqual_handle handle,
-		const char *password, kadm5_policy_ent_t policy,
-		krb5_principal princ)
+                const char *password, kadm5_policy_ent_t policy,
+                krb5_principal princ)
 {
     return handle->vt.check(context, handle->data, password, policy, princ);
 }

Modified: branches/plugins2/src/lib/kadm5/srv/pwqual_dict.c
===================================================================
--- branches/plugins2/src/lib/kadm5/srv/pwqual_dict.c	2010-07-26 22:14:21 UTC (rev 24213)
+++ branches/plugins2/src/lib/kadm5/srv/pwqual_dict.c	2010-07-26 22:16:56 UTC (rev 24214)
@@ -212,11 +212,11 @@
     n = krb5_princ_size(handle->context, princ);
     cp = krb5_princ_realm(handle->context, princ)->data;
     if (strcasecmp(cp, password) == 0)
-	return KADM5_PASS_Q_DICT;
+        return KADM5_PASS_Q_DICT;
     for (i = 0; i < n; i++) {
-	cp = krb5_princ_component(handle->context, princ, i)->data;
-	if (strcasecmp(cp, password) == 0)
-	    return KADM5_PASS_Q_DICT;
+        cp = krb5_princ_component(handle->context, princ, i)->data;
+        if (strcasecmp(cp, password) == 0)
+            return KADM5_PASS_Q_DICT;
     }
     return 0;
 }

Modified: branches/plugins2/src/lib/kadm5/srv/pwqual_policy.c
===================================================================
--- branches/plugins2/src/lib/kadm5/srv/pwqual_policy.c	2010-07-26 22:14:21 UTC (rev 24213)
+++ branches/plugins2/src/lib/kadm5/srv/pwqual_policy.c	2010-07-26 22:16:56 UTC (rev 24214)
@@ -37,33 +37,33 @@
 /* Implement the password quality check module. */
 static krb5_error_code
 policy_check(krb5_context context, krb5_pwqual_moddata data,
-	     const char *password, kadm5_policy_ent_t policy,
-	     krb5_principal princ)
+             const char *password, kadm5_policy_ent_t policy,
+             krb5_principal princ)
 {
     int nupper = 0, nlower = 0, ndigit = 0, npunct = 0, nspec = 0;
     const char *s;
     unsigned char c;
 
     if (policy == NULL)
-	return (*password == '\0') ? KADM5_PASS_Q_TOOSHORT : 0;
+        return (*password == '\0') ? KADM5_PASS_Q_TOOSHORT : 0;
 
     if(strlen(password) < (size_t)policy->pw_min_length)
-	return KADM5_PASS_Q_TOOSHORT;
+        return KADM5_PASS_Q_TOOSHORT;
     s = password;
     while ((c = (unsigned char)*s++)) {
-	if (islower(c))
-	    nlower = 1;
-	else if (isupper(c))
-	    nupper = 1;
-	else if (isdigit(c))
-	    ndigit = 1;
-	else if (ispunct(c))
-	    npunct = 1;
-	else
-	    nspec = 1;
+        if (islower(c))
+            nlower = 1;
+        else if (isupper(c))
+            nupper = 1;
+        else if (isdigit(c))
+            ndigit = 1;
+        else if (ispunct(c))
+            npunct = 1;
+        else
+            nspec = 1;
     }
     if ((nupper + nlower + ndigit + npunct + nspec) < policy->pw_min_classes)
-	return KADM5_PASS_Q_CLASS;
+        return KADM5_PASS_Q_CLASS;
     return 0;
 }
 

Modified: branches/plugins2/src/lib/krb5/krb/plugin.c
===================================================================
--- branches/plugins2/src/lib/krb5/krb/plugin.c	2010-07-26 22:14:21 UTC (rev 24213)
+++ branches/plugins2/src/lib/krb5/krb/plugin.c	2010-07-26 22:16:56 UTC (rev 24214)
@@ -39,7 +39,7 @@
 get_interface(krb5_context context, int id)
 {
     if (context == NULL || id < 0 || id >= PLUGIN_NUM_INTERFACES)
-	return NULL;
+        return NULL;
     return &context->plugins[id];
 }
 
@@ -48,10 +48,10 @@
 free_plugin_mapping(struct plugin_mapping *map)
 {
     if (map == NULL)
-	return;
+        return;
     free(map->modname);
     if (map->dyn_handle != NULL)
-	krb5int_close_plugin(map->dyn_handle);
+        krb5int_close_plugin(map->dyn_handle);
     free(map);
 }
 
@@ -69,22 +69,22 @@
 
     /* If a mapping already exists for modname, remove it. */
     for (pmap = &interface->modules; *pmap != NULL; pmap = &(*pmap)->next) {
-	map = *pmap;
-	if (strcmp(map->modname, modname) == 0) {
-	    *pmap = map->next;
-	    free_plugin_mapping(map);
-	    break;
-	}
+        map = *pmap;
+        if (strcmp(map->modname, modname) == 0) {
+            *pmap = map->next;
+            free_plugin_mapping(map);
+            break;
+        }
     }
 
     /* Create a new mapping structure. */
     map = malloc(sizeof(*map));
     if (map == NULL)
-	return ENOMEM;
+        return ENOMEM;
     map->modname = strdup(modname);
     if (map->modname == NULL) {
-	free(map);
-	return ENOMEM;
+        free(map);
+        return ENOMEM;
     }
     map->module = module;
     map->dyn_handle = dyn_handle;
@@ -99,7 +99,7 @@
  * component parts. */
 static krb5_error_code
 parse_modstr(krb5_context context, const char *modstr,
-	     char **modname, char **modpath)
+             char **modname, char **modpath)
 {
     const char *sep;
     char *name = NULL, *path = NULL;
@@ -109,23 +109,23 @@
 
     sep = strchr(modstr, ':');
     if (sep == NULL) {
-	krb5_set_error_message(context, EINVAL, "Invalid module string %s",
-			       modstr);
-	return EINVAL; /* XXX create specific error code */
+        krb5_set_error_message(context, EINVAL, "Invalid module string %s",
+                               modstr);
+        return EINVAL; /* XXX create specific error code */
     }
 
     /* Copy the module name. */
     name = malloc(sep - modstr + 1);
     if (name == NULL)
-	return ENOMEM;
+        return ENOMEM;
     memcpy(name, modstr, sep - modstr);
     name[sep - modstr] = '\0';
 
     /* Copy the module path. */
     path = strdup(sep + 1);
     if (path == NULL) {
-	free(name);
-	return ENOMEM;
+        free(name);
+        return ENOMEM;
     }
 
     *modname = name;
@@ -137,8 +137,8 @@
  * the resulting init function as modname. */
 static krb5_error_code
 open_and_register(krb5_context context, struct plugin_interface *interface,
-		  const char *modname, const char *modpath,
-		  const char *symname)
+                  const char *modname, const char *modpath,
+                  const char *symname)
 {
     krb5_error_code ret;
     struct plugin_file_handle *handle;
@@ -146,45 +146,45 @@
 
     ret = krb5int_open_plugin(modpath, &handle, &context->err);
     if (ret != 0)
-	return ret;
+        return ret;
 
     ret = krb5int_get_plugin_func(handle, symname, &initvt_fn, &context->err);
     if (ret != 0) {
-	krb5int_close_plugin(handle);
-	return ret;
+        krb5int_close_plugin(handle);
+        return ret;
     }
 
     ret = register_module(context, interface, modname,
                           (krb5_plugin_initvt_fn)initvt_fn, handle);
     if (ret != 0)
-	krb5int_close_plugin(handle);
+        krb5int_close_plugin(handle);
     return ret;
 }
 
 /* Register the plugins given by the profile strings in modules. */
 static krb5_error_code
 register_dyn_modules(krb5_context context, struct plugin_interface *interface,
-		     const char *iname, char **modules)
+                     const char *iname, char **modules)
 {
     krb5_error_code ret;
     char *modname = NULL, *modpath = NULL, *symname = NULL;
 
     for (; *modules != NULL; modules++) {
-	ret = parse_modstr(context, *modules, &modname, &modpath);
-	if (ret != 0)
-	    return ret;
+        ret = parse_modstr(context, *modules, &modname, &modpath);
+        if (ret != 0)
+            return ret;
         if (asprintf(&symname, "%s_%s_initvt", iname, modname) < 0) {
-	    free(modname);
-	    free(modpath);
-	    return ENOMEM;
-	}
-	/* XXX should errors here be fatal, or just ignore the module? */
-	ret = open_and_register(context, interface, modname, modpath, symname);
-	free(modname);
-	free(modpath);
-	free(symname);
-	if (ret != 0)
-	    return ret;
+            free(modname);
+            free(modpath);
+            return ENOMEM;
+        }
+        /* XXX should errors here be fatal, or just ignore the module? */
+        ret = open_and_register(context, interface, modname, modpath, symname);
+        free(modname);
+        free(modpath);
+        free(symname);
+        if (ret != 0)
+            return ret;
     }
     return 0;
 }
@@ -194,8 +194,8 @@
 find_in_list(char **list, const char *value)
 {
     for (; *list != NULL; list++) {
-	if (strcmp(*list, value) == 0)
-	    return TRUE;
+        if (strcmp(*list, value) == 0)
+            return TRUE;
     }
     return FALSE;
 }
@@ -203,36 +203,36 @@
 /* Remove any registered modules whose names are not present in enable. */
 static void
 filter_enable(krb5_context context, struct plugin_interface *interface,
-	      char **enable)
+              char **enable)
 {
     struct plugin_mapping *map, **pmap;
 
     pmap = &interface->modules;
     while (*pmap != NULL) {
-	map = *pmap;
-	if (!find_in_list(enable, map->modname)) {
-	    *pmap = map->next;
-	    free_plugin_mapping(map);
-	} else
-	    pmap = &map->next;
+        map = *pmap;
+        if (!find_in_list(enable, map->modname)) {
+            *pmap = map->next;
+            free_plugin_mapping(map);
+        } else
+            pmap = &map->next;
     }
 }
 
 /* Remove any registered modules whose names are present in disable. */
 static void
 filter_disable(krb5_context context, struct plugin_interface *interface,
-	       char **disable)
+               char **disable)
 {
     struct plugin_mapping *map, **pmap;
 
     pmap = &interface->modules;
     while (*pmap != NULL) {
-	map = *pmap;
-	if (find_in_list(disable, map->modname)) {
-	    *pmap = map->next;
-	    free_plugin_mapping(map);
-	} else
-	    pmap = &map->next;
+        map = *pmap;
+        if (find_in_list(disable, map->modname)) {
+            *pmap = map->next;
+            free_plugin_mapping(map);
+        } else
+            pmap = &map->next;
     }
 }
 
@@ -247,7 +247,7 @@
     static const char *path[4];
 
     if (interface->configured)
-	return 0;
+        return 0;
 
     /* Read the configuration variables for this interface. */
     path[0] = KRB5_CONF_PLUGINS;
@@ -267,14 +267,14 @@
         goto cleanup;
 
     if (modules != NULL) {
-	ret = register_dyn_modules(context, interface, iname, modules);
-	if (ret != 0)
-	    return ret;
+        ret = register_dyn_modules(context, interface, iname, modules);
+        if (ret != 0)
+            return ret;
     }
     if (enable != NULL)
-	filter_enable(context, interface, enable);
+        filter_enable(context, interface, enable);
     if (disable != NULL)
-	filter_disable(context, interface, disable);
+        filter_disable(context, interface, disable);
 
     ret = 0;
 cleanup:
@@ -293,15 +293,15 @@
     struct plugin_mapping *map;
 
     if (interface == NULL)
-	return EINVAL;
+        return EINVAL;
     ret = configure_interface(context, interface_id);
     if (ret != 0)
-	return ret;
+        return ret;
     for (map = interface->modules; map != NULL; map = map->next) {
-	if (strcmp(map->modname, modname) == 0) {
-	    *module = map->module;
-	    return 0;
-	}
+        if (strcmp(map->modname, modname) == 0) {
+            *module = map->module;
+            return 0;
+        }
     }
     return ENOENT; /* XXX Create error code? */
 }
@@ -317,23 +317,23 @@
     size_t count;
 
     if (interface == NULL)
-	return EINVAL;
+        return EINVAL;
     ret = configure_interface(context, interface_id);
     if (ret != 0)
-	return ret;
+        return ret;
 
     /* Count the modules and allocate a list to hold them. */
     count = 0;
     for (map = interface->modules; map != NULL; map = map->next)
-	count++;
+        count++;
     list = malloc((count + 1) * sizeof(*list));
     if (list == NULL)
-	return ENOMEM;
+        return ENOMEM;
 
     /* Place each module's initvt function into list. */
     count = 0;
     for (map = interface->modules; map != NULL; map = map->next)
-	list[count++] = map->module;
+        list[count++] = map->module;
     list[count] = NULL;
 
     *modules = list;
@@ -353,12 +353,12 @@
     struct plugin_interface *interface = get_interface(context, interface_id);
 
     if (interface == NULL)
-	return EINVAL;
+        return EINVAL;
 
     /* Disallow registering plugins after load.  We may need to reconsider
      * this, but it simplifies the design. */
     if (interface->configured)
-	return EINVAL;
+        return EINVAL;
 
     return register_module(context, interface, modname, module, NULL);
 }
@@ -371,12 +371,12 @@
     struct plugin_mapping *map, *next;
 
     for (i = 0; i < PLUGIN_NUM_INTERFACES; i++) {
-	interface = &context->plugins[i];
-	for (map = interface->modules; map != NULL; map = next) {
-	    next = map->next;
-	    free_plugin_mapping(map);
-	}
-	interface->modules = NULL;
-	interface->configured = FALSE;
+        interface = &context->plugins[i];
+        for (map = interface->modules; map != NULL; map = next) {
+            next = map->next;
+            free_plugin_mapping(map);
+        }
+        interface->modules = NULL;
+        interface->configured = FALSE;
     }
 }




More information about the cvs-krb5 mailing list