From: Greg Hudson Date: Mon, 26 Jul 2010 22:16:56 +0000 (+0000) Subject: In the plugins2 branch, untabify new files which accidentally used X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04067d729bfc7b648b643e883b4228e3b8ac5119;p=thirdparty%2Fkrb5.git In the plugins2 branch, untabify new files which accidentally used tabs in indentation. git-svn-id: svn://anonsvn.mit.edu/krb5/branches/plugins2@24214 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/pwqual_combo/combo.c b/pwqual_combo/combo.c index 7f6613d9df..f95dc8ea29 100644 --- a/pwqual_combo/combo.c +++ b/pwqual_combo/combo.c @@ -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; diff --git a/src/include/krb5/pwqual_plugin.h b/src/include/krb5/pwqual_plugin.h index a5eeb8c5c9..311c7038d9 100644 --- a/src/include/krb5/pwqual_plugin.h +++ b/src/include/krb5/pwqual_plugin.h @@ -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); diff --git a/src/lib/kadm5/srv/pwqual.c b/src/lib/kadm5/srv/pwqual.c index faece8efdc..c40f74fb85 100644 --- a/src/lib/kadm5/srv/pwqual.c +++ b/src/lib/kadm5/srv/pwqual.c @@ -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); } diff --git a/src/lib/kadm5/srv/pwqual_dict.c b/src/lib/kadm5/srv/pwqual_dict.c index 7fb05b4e32..360b0638bd 100644 --- a/src/lib/kadm5/srv/pwqual_dict.c +++ b/src/lib/kadm5/srv/pwqual_dict.c @@ -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; } diff --git a/src/lib/kadm5/srv/pwqual_policy.c b/src/lib/kadm5/srv/pwqual_policy.c index 4bd8808b85..33e9b1a30e 100644 --- a/src/lib/kadm5/srv/pwqual_policy.c +++ b/src/lib/kadm5/srv/pwqual_policy.c @@ -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; } diff --git a/src/lib/krb5/krb/plugin.c b/src/lib/krb5/krb/plugin.c index dcc778d2d2..ad045c13e8 100644 --- a/src/lib/krb5/krb/plugin.c +++ b/src/lib/krb5/krb/plugin.c @@ -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; } }