void module_app_unload(void) { struct le *le = list_tail(mod_list()); /* unload in reverse order */ while (le) { struct mod *mod = le->data; const struct mod_export *me = mod_export(mod); le = le->prev; if (me && 0 == str_casecmp(me->type, "application")) { debug("module: unloading app %s\n", me->name); mem_deref(mod); } } }
/* * Set *result to a zero-terminated list of enctypes resulting from * parsing profstr. profstr may be modified during parsing. */ krb5_error_code krb5int_parse_enctype_list(krb5_context context, const char *profkey, char *profstr, krb5_enctype *default_list, krb5_enctype **result) { char *token, *delim = " \t\r\n,", *save = NULL; krb5_boolean sel, weak = context->allow_weak_crypto; krb5_enctype etype, *list; unsigned int i; *result = NULL; /* Set up an empty list. Allocation failure is detected at the end. */ list = malloc(sizeof(krb5_enctype)); if (list != NULL) list[0] = 0; /* Walk through the words in profstr. */ for (token = strtok_r(profstr, delim, &save); token; token = strtok_r(NULL, delim, &save)) { /* Determine if we are adding or removing enctypes. */ sel = TRUE; if (*token == '+' || *token == '-') sel = (*token++ == '+'); if (strcasecmp(token, "DEFAULT") == 0) { /* Set all enctypes in the default list. */ for (i = 0; default_list[i]; i++) mod_list(default_list[i], sel, weak, &list); } else if (strcasecmp(token, "des") == 0) { mod_list(ENCTYPE_DES_CBC_CRC, sel, weak, &list); mod_list(ENCTYPE_DES_CBC_MD5, sel, weak, &list); mod_list(ENCTYPE_DES_CBC_MD4, sel, weak, &list); } else if (strcasecmp(token, "des3") == 0) { mod_list(ENCTYPE_DES3_CBC_SHA1, sel, weak, &list); } else if (strcasecmp(token, "aes") == 0) { mod_list(ENCTYPE_AES256_CTS_HMAC_SHA1_96, sel, weak, &list); mod_list(ENCTYPE_AES128_CTS_HMAC_SHA1_96, sel, weak, &list); mod_list(ENCTYPE_AES256_CTS_HMAC_SHA384_192, sel, weak, &list); mod_list(ENCTYPE_AES128_CTS_HMAC_SHA256_128, sel, weak, &list); } else if (strcasecmp(token, "rc4") == 0) { mod_list(ENCTYPE_ARCFOUR_HMAC, sel, weak, &list); } else if (strcasecmp(token, "camellia") == 0) { mod_list(ENCTYPE_CAMELLIA256_CTS_CMAC, sel, weak, &list); mod_list(ENCTYPE_CAMELLIA128_CTS_CMAC, sel, weak, &list); } else if (krb5_string_to_enctype(token, &etype) == 0) { /* Set a specific enctype. */ mod_list(etype, sel, weak, &list); } else { TRACE_ENCTYPE_LIST_UNKNOWN(context, profkey, token); } } if (list == NULL) return ENOMEM; *result = list; return 0; }