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
41 struct krb5_context_data {
42 krb5_config_section *cf;
45 typedef struct krb5_context_data * krb5_context;
46 typedef int krb5_error_code;
47 typedef int krb5_boolean;
48 typedef time_t krb5_deltat;
50 static void krb5_set_error_message(krb5_context context, krb5_error_code ret,
51 const char *fmt, ...) {
55 #ifdef EXPAND_PATH_HEADER
59 static int _krb5_expand_path_tokens(krb5_context, const char *, char**);
62 _cmd_ExpandPathTokens(krb5_context context, const char *in, char **out) {
63 return _krb5_expand_path_tokens(context, in, out);
66 HINSTANCE _krb5_hInstance = NULL;
68 /* This bodge avoids the need for everything linking against cmd to also
69 * link against the shell library on Windows */
70 #undef SHGetFolderPath
71 #define SHGetFolderPath internal_getpath
73 HRESULT internal_getpath(void *a, int b, void *c, DWORD d, LPTSTR out) {
79 #define KRB5_CONFIG_BADFORMAT CMD_BADFORMAT
81 #define _krb5_expand_path_tokens _cmd_ExpandPathTokens
83 extern int _cmd_ExpandPathTokens(krb5_context, const char *, char **);
85 static const void *_krb5_config_vget(krb5_context,
86 const krb5_config_section *, int,
88 static const void *_krb5_config_vget_next(krb5_context,
89 const krb5_config_section *,
90 const krb5_config_binding **,
92 static const char *krb5_config_vget_string(krb5_context,
93 const krb5_config_section *,
95 static const char *krb5_config_vget_string_default(krb5_context,
96 const krb5_config_section *,
99 static const krb5_config_binding * krb5_config_vget_list
100 (krb5_context, const krb5_config_section *, va_list);
101 static krb5_error_code krb5_config_parse_file_multi
102 (krb5_context, const char *, krb5_config_section **);
103 static krb5_error_code krb5_config_parse_file
104 (krb5_context, const char *, krb5_config_section **);
105 static krb5_error_code krb5_config_file_free
106 (krb5_context, krb5_config_section *);
107 static krb5_boolean krb5_config_vget_bool_default
108 (krb5_context, const krb5_config_section *, int, va_list);
109 static int krb5_config_vget_int_default
110 (krb5_context, const krb5_config_section *, int, va_list);
112 static krb5_error_code
113 krb5_string_to_deltat(const char *str, krb5_deltat *t) {
117 KRB5_LIB_FUNCTION void krb5_clear_error_message(krb5_context context) {
122 static int _krb5_homedir_access(krb5_context context) {
126 static krb5_error_code
127 krb5_abortx(krb5_context context, const char *fmt, ...)
132 vfprintf(stderr, fmt, ap);
142 cmd_RawConfigParseFileMulti(const char *fname, cmd_config_section **res) {
143 return krb5_config_parse_file_multi(NULL, fname, res);
147 cmd_RawConfigParseFile(const char *fname, cmd_config_section **res) {
148 return krb5_config_parse_file(NULL, fname, res);
152 cmd_RawConfigFileFree(cmd_config_section *s) {
153 return krb5_config_file_free(NULL, s);
157 cmd_RawConfigGetString(const cmd_config_section *c,
158 const char *defval, ...)
165 va_start(args, defval);
166 ret = krb5_config_vget_string_default (NULL, c, defval, args);
172 cmd_RawConfigGetBool(const cmd_config_section *c, int defval, ...)
179 va_start(ap, defval);
180 ret = krb5_config_vget_bool_default (NULL, c, defval, ap);
186 cmd_RawConfigGetInt(const cmd_config_section *c, int defval, ...)
193 va_start(ap, defval);
194 ret = krb5_config_vget_int_default (NULL, c, defval, ap);
199 const cmd_config_binding *
200 cmd_RawConfigGetList(const cmd_config_section *c, ...)
203 const cmd_config_binding *ret;
208 ret = krb5_config_vget_list (NULL, c, ap);