2 /* This header file transforms the Heimdal config_parse.c profile
3 * parser into an AFS profile parser, hiding the krb5-ness of the parser
17 #define PACKAGE "openafs"
26 #define KRB5_BUFSIZ 1024
28 #define KRB5_LIB_FUNCTION static AFS_UNUSED
31 #define KRB5_DEPRECATED_FUNCTION(x)
35 typedef struct cmd_config_binding krb5_config_binding
;
36 typedef struct cmd_config_binding krb5_config_section
;
38 #define krb5_config_list cmd_config_list
39 #define krb5_config_string cmd_config_string
40 #define _krb5_config_get_entry _cmd_config_get_entry
42 struct krb5_context_data
{
43 krb5_config_section
*cf
;
46 typedef struct krb5_context_data
* krb5_context
;
47 typedef int krb5_error_code
;
48 typedef int krb5_boolean
;
49 typedef time_t krb5_deltat
;
51 static void krb5_set_error_message(krb5_context context
, krb5_error_code ret
,
52 const char *fmt
, ...) {
56 static krb5_error_code
57 krb5_enomem(krb5_context context
)
62 #ifdef EXPAND_PATH_HEADER
66 static int _krb5_expand_path_tokens(krb5_context
, const char *, char**);
69 _cmd_ExpandPathTokens(krb5_context context
, const char *in
, char **out
) {
70 return _krb5_expand_path_tokens(context
, in
, out
);
73 HINSTANCE _krb5_hInstance
= NULL
;
75 /* This bodge avoids the need for everything linking against cmd to also
76 * link against the shell library on Windows */
77 #undef SHGetFolderPath
78 #define SHGetFolderPath internal_getpath
80 HRESULT
internal_getpath(void *a
, int b
, void *c
, DWORD d
, LPTSTR out
) {
86 #define KRB5_CONFIG_BADFORMAT CMD_BADFORMAT
88 #define _krb5_expand_path_tokens _cmd_ExpandPathTokens
90 extern int _cmd_ExpandPathTokens(krb5_context
, const char *, char **);
92 static const void *_krb5_config_vget(krb5_context
,
93 const krb5_config_section
*, int,
95 static const void *_krb5_config_vget_next(krb5_context
,
96 const krb5_config_section
*,
97 const krb5_config_binding
**,
99 static const char *krb5_config_vget_string(krb5_context
,
100 const krb5_config_section
*,
102 static const char *krb5_config_vget_string_default(krb5_context
,
103 const krb5_config_section
*,
106 static const krb5_config_binding
* krb5_config_vget_list
107 (krb5_context
, const krb5_config_section
*, va_list);
108 static krb5_error_code krb5_config_parse_file_multi
109 (krb5_context
, const char *, krb5_config_section
**);
110 static krb5_error_code krb5_config_parse_file
111 (krb5_context
, const char *, krb5_config_section
**);
112 static krb5_error_code krb5_config_file_free
113 (krb5_context
, krb5_config_section
*);
114 static krb5_boolean krb5_config_vget_bool_default
115 (krb5_context
, const krb5_config_section
*, int, va_list);
116 static int krb5_config_vget_int_default
117 (krb5_context
, const krb5_config_section
*, int, va_list);
119 static krb5_error_code
120 krb5_string_to_deltat(const char *str
, krb5_deltat
*t
) {
124 KRB5_LIB_FUNCTION
void krb5_clear_error_message(krb5_context context
) {
129 static int _krb5_homedir_access(krb5_context context
) {
133 static krb5_error_code
134 krb5_abortx(krb5_context context
, const char *fmt
, ...)
139 vfprintf(stderr
, fmt
, ap
);
149 cmd_RawConfigParseFileMulti(const char *fname
, cmd_config_section
**res
) {
150 return krb5_config_parse_file_multi(NULL
, fname
, res
);
154 cmd_RawConfigParseFile(const char *fname
, cmd_config_section
**res
) {
155 return krb5_config_parse_file(NULL
, fname
, res
);
159 cmd_RawConfigFileFree(cmd_config_section
*s
) {
160 return krb5_config_file_free(NULL
, s
);
164 cmd_RawConfigGetString(const cmd_config_section
*c
,
165 const char *defval
, ...)
172 va_start(args
, defval
);
173 ret
= krb5_config_vget_string_default (NULL
, c
, defval
, args
);
179 cmd_RawConfigGetBool(const cmd_config_section
*c
, int defval
, ...)
186 va_start(ap
, defval
);
187 ret
= krb5_config_vget_bool_default (NULL
, c
, defval
, ap
);
193 cmd_RawConfigGetInt(const cmd_config_section
*c
, int defval
, ...)
200 va_start(ap
, defval
);
201 ret
= krb5_config_vget_int_default (NULL
, c
, defval
, ap
);
206 const cmd_config_binding
*
207 cmd_RawConfigGetList(const cmd_config_section
*c
, ...)
210 const cmd_config_binding
*ret
;
215 ret
= krb5_config_vget_list (NULL
, c
, ap
);