]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
In the plugins2 branch, untabify new files which accidentally used
authorGreg Hudson <ghudson@mit.edu>
Mon, 26 Jul 2010 22:16:56 +0000 (22:16 +0000)
committerGreg Hudson <ghudson@mit.edu>
Mon, 26 Jul 2010 22:16:56 +0000 (22:16 +0000)
tabs in indentation.

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/plugins2@24214 dc483132-0cff-0310-8789-dd5450dbe970

pwqual_combo/combo.c
src/include/krb5/pwqual_plugin.h
src/lib/kadm5/srv/pwqual.c
src/lib/kadm5/srv/pwqual_dict.c
src/lib/kadm5/srv/pwqual_policy.c
src/lib/krb5/krb/plugin.c

index 7f6613d9df7e578d7c1615b4aa80fbfd9342f87d..f95dc8ea294f0b55adc5b4772891a9c2a407ec44 100644 (file)
@@ -106,7 +106,7 @@ destroy_dict(combo_moddata dict)
 
 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 @@ combo_open(krb5_context context, const char *dict_file,
 
 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;
index a5eeb8c5c9a20aa2ff440ff85b5766d2d515b90a..311c7038d9496d4cca6726ef655c9d3462cd7947 100644 (file)
@@ -50,8 +50,8 @@ typedef struct krb5_pwqual_vtable_st {
      * 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);
index faece8efdc5f8a9afcef0832ff2e506689549eea..c40f74fb85df13b17aa4f86fb0694ebcd8563650 100644 (file)
@@ -47,26 +47,26 @@ k5_pwqual_load(krb5_context context, pwqual_handle **handles)
 
     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 @@ k5_pwqual_open(krb5_context context, pwqual_handle handle,
                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 @@ k5_pwqual_open(krb5_context context, pwqual_handle handle,
 
 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);
 }
index 7fb05b4e323e94f650e8690f3cc89ba1d8c26f0b..360b0638bd91cd4e2c197b451f5be9f2c1b6066b 100644 (file)
@@ -212,11 +212,11 @@ dict_check(krb5_context context, krb5_pwqual_moddata data,
     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;
 }
index 4bd8808b858a4023f7fa3be5860edcf7777c6853..33e9b1a30e6859d7761beceef66148a75b4ffab1 100644 (file)
 /* 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;
 }
 
index dcc778d2d2391d1de53cb56195feebc69b8138ca..ad045c13e856052d31b4c703ccf7d9e8592374cf 100644 (file)
@@ -39,7 +39,7 @@ static inline struct plugin_interface *
 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 @@ static void
 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 @@ register_module(krb5_context context, struct plugin_interface *interface,
 
     /* 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 @@ register_module(krb5_context context, struct plugin_interface *interface,
  * 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 @@ parse_modstr(krb5_context context, const char *modstr,
 
     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 @@ parse_modstr(krb5_context context, const char *modstr,
  * 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 @@ open_and_register(krb5_context context, struct plugin_interface *interface,
 
     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 @@ static krb5_boolean
 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 @@ find_in_list(char **list, const char *value)
 /* 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 @@ configure_interface(krb5_context context, int id)
     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 @@ configure_interface(krb5_context context, int id)
         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 @@ k5_plugin_load(krb5_context context, int interface_id, const char *modname,
     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 @@ k5_plugin_load_all(krb5_context context, int interface_id,
     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 @@ k5_plugin_register(krb5_context context, int interface_id, const char *modname,
     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 @@ k5_plugin_free_context(krb5_context context)
     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;
     }
 }