prof_get.c revision 505d05c73a6e56769f263d4803b22eddd168ee24
af687ddbab64fce492e06d194acd60da69b59608nd#pragma ident "%Z%%M% %I% %E% SMI"
af687ddbab64fce492e06d194acd60da69b59608nd * prof_get.c --- routines that expose the public interfaces for
af687ddbab64fce492e06d194acd60da69b59608nd * querying items from the profile.
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * These functions --- init_list(), end_list(), and add_to_list() are
af687ddbab64fce492e06d194acd60da69b59608nd * internal functions used to build up a null-terminated char ** list
af687ddbab64fce492e06d194acd60da69b59608nd * of strings to be returned by functions like profile_get_values.
3f08db06526d6901aa08c110b5bc7dde6bc39905nd * The profile_string_list structure is used for internal booking
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd * purposes to build up the list, which is returned in *ret_list by
a78048ccbdb6256da15e6b0e7e95355e480c2301nd * the end_list() function.
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung * The publicly exported interface for freeing char** list is
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd * profile_free_list().
6df89e6e4adeb986b41b7ec6b7593a887e031ce7nd * Initialize the string list abstraction.
af687ddbab64fce492e06d194acd60da69b59608ndstatic errcode_t init_list(struct profile_string_list *list)
af687ddbab64fce492e06d194acd60da69b59608nd list->list = (char **) malloc(list->max * sizeof(char *));
af687ddbab64fce492e06d194acd60da69b59608nd * Free any memory left over in the string abstraction, returning the
af687ddbab64fce492e06d194acd60da69b59608nd * built up list in *ret_list if it is non-null.
af687ddbab64fce492e06d194acd60da69b59608ndstatic void end_list(struct profile_string_list *list, char ***ret_list)
int newmax;
if (newlist == 0)
return ENOMEM;
if (newstr == 0)
return ENOMEM;
char **cpp;
char **cp;
if (list == 0)
char ***ret_values)
void *state;
char *value;
&state)))
return retval;
return retval;
goto cleanup;
if (value)
} while (state);
goto cleanup;
return retval;
const char **ret_value)
void *state;
char *value;
&state)))
return retval;
goto cleanup;
if (value)
return retval;
char **ret_string)
const char *value;
if (profile) {
else if (retval)
return retval;
if (value) {
if (*ret_string == 0)
return ENOMEM;
*ret_string = 0;
const char *value;
char *end_value;
long ret_long;
if (profile == 0)
} else if (retval)
return retval;
if (value[0] == 0)
return PROF_BAD_INTEGER;
errno = 0;
return PROF_BAD_INTEGER;
return PROF_BAD_INTEGER;
return PROF_BAD_INTEGER;
static const char *const conf_yes[] = {
static const char *const conf_no[] = {
static errcode_t
return PROF_EINVAL;
for(p=conf_yes; *p; p++) {
if (!strcasecmp(*p,s)) {
for(p=conf_no; *p; p++) {
if (!strcasecmp(*p,s)) {
*ret_boolean = 0;
return PROF_BAD_BOOLEAN;
const char *value;
if (profile == 0) {
} else if (retval)
return retval;
char ***ret_names)
void *state;
char *name;
&state)))
return retval;
return retval;
goto cleanup;
if (name)
} while (state);
return retval;
char ***ret_names)
void *state;
char *name;
&state)))
return retval;
return retval;
goto cleanup;
} while (state);
return retval;
void **ret_iter)
void KRB5_CALLCONV
if (retval)
return retval;
if (ret_name) {
if (name) {
if (!*ret_name)
return ENOMEM;
*ret_name = 0;
if (ret_value) {
if (value) {
if (!*ret_value) {
if (ret_name) {
*ret_name = 0;
return ENOMEM;
*ret_value = 0;
void KRB5_CALLCONV