Annotation of /trunk/cyrus-sasl/patches/cyrus-sasl-2.1.20-configdir.patch
Parent Directory | Revision Log
Revision 144 -
(hide annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 8231 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 8231 byte(s)
-import
1 | niro | 144 | diff -urN cyrus-sasl-2.1.17.orig/configure.in cyrus-sasl-2.1.17/configure.in |
2 | --- cyrus-sasl-2.1.17.orig/configure.in Tue May 9 19:52:53 2000 | ||
3 | +++ cyrus-sasl-2.1.17/configure.in Thu Jun 1 13:48:11 2000 | ||
4 | @@ -710,6 +710,13 @@ | ||
5 | AC_DEFINE_UNQUOTED(PLUGINDIR, "$plugindir", [Runtime plugin location]) | ||
6 | AC_SUBST(plugindir) | ||
7 | |||
8 | +AC_ARG_WITH(configdir, [ --with-configdir=DIR set the directory where config files will | ||
9 | + be found [/etc/sasl] ], | ||
10 | + configdir=$withval, | ||
11 | + configdir=/etc/sasl) | ||
12 | +AC_DEFINE_UNQUOTED(CONFIGDIR, "$configdir", [Runtime config file location]) | ||
13 | +AC_SUBST(configdir) | ||
14 | + | ||
15 | dnl look for rc4 libraries. we accept the CMU one or one from openSSL | ||
16 | AC_ARG_WITH(rc4, [ --with-rc4 use internal rc4 routines [yes] ], | ||
17 | with_rc4=$withval, | ||
18 | @@ -1006,6 +1013,7 @@ | ||
19 | #endif | ||
20 | |||
21 | #define SASL_PATH_ENV_VAR "SASL_PATH" | ||
22 | +#define SASL_CONF_PATH_ENV_VAR "SASL_CONF_PATH" | ||
23 | |||
24 | #include <stdlib.h> | ||
25 | #include <sys/types.h> | ||
26 | diff -urN cyrus-sasl-2.1.17.orig/include/sasl.h cyrus-sasl-2.1.17/include/sasl.h | ||
27 | --- cyrus-sasl-2.1.17.orig/include/sasl.h Tue May 9 19:52:53 2000 | ||
28 | +++ cyrus-sasl-2.1.17/include/sasl.h Thu Jun 1 13:04:48 2000 | ||
29 | @@ -25,6 +25,7 @@ | ||
30 | * | ||
31 | * Server only Callbacks: | ||
32 | * sasl_authorize_t user authorization policy callback | ||
33 | + * sasl_getconfpath_t get path to search for config file | ||
34 | * sasl_server_userdb_checkpass check password and auxprops in userdb | ||
35 | * sasl_server_userdb_setpass set password in userdb | ||
36 | * sasl_server_canon_user canonicalize username routine | ||
37 | @@ -439,6 +440,24 @@ | ||
38 | const char *file, sasl_verify_type_t type); | ||
39 | #define SASL_CB_VERIFYFILE 4 | ||
40 | |||
41 | +/* getconfpath callback -- this allows applications to specify the | ||
42 | + * colon-separated path to search for config files (by default, | ||
43 | + * taken from the SASL_CONF_PATH environment variable). | ||
44 | + * inputs: | ||
45 | + * context -- getconfpath context from the callback record | ||
46 | + * outputs: | ||
47 | + * path -- colon seperated path (allocated on the heap; the | ||
48 | + * library will free it using the sasl_free_t * | ||
49 | + * passed to sasl_set_callback, or the standard free() | ||
50 | + * library call). | ||
51 | + * returns: | ||
52 | + * SASL_OK -- no error | ||
53 | + * SASL_FAIL -- error | ||
54 | + */ | ||
55 | +typedef int sasl_getconfpath_t(void *context, | ||
56 | + char **path); | ||
57 | + | ||
58 | +#define SASL_CB_GETCONFPATH 5 | ||
59 | |||
60 | /* client/user interaction callbacks: | ||
61 | */ | ||
62 | diff -urN cyrus-sasl-2.1.17.orig/lib/common.c cyrus-sasl-2.1.17/lib/common.c | ||
63 | --- cyrus-sasl-2.1.17.orig/lib/common.c Fri May 5 14:41:42 2000 | ||
64 | +++ cyrus-sasl-2.1.17/lib/common.c Thu Jun 1 12:53:19 2000 | ||
65 | @@ -1047,6 +1047,20 @@ | ||
66 | } | ||
67 | |||
68 | static int | ||
69 | +_sasl_getconfpath(void *context __attribute__((unused)), | ||
70 | + char ** path_dest) | ||
71 | +{ | ||
72 | + char *path; | ||
73 | + | ||
74 | + if (! path_dest) | ||
75 | + return SASL_BADPARAM; | ||
76 | + path = getenv(SASL_CONF_PATH_ENV_VAR); | ||
77 | + if (! path) | ||
78 | + path = CONFIGDIR; | ||
79 | + return _sasl_strdup(path, path_dest, NULL); | ||
80 | +} | ||
81 | + | ||
82 | +static int | ||
83 | _sasl_verifyfile(void *context __attribute__((unused)), | ||
84 | char *file __attribute__((unused)), | ||
85 | int type __attribute__((unused))) | ||
86 | @@ -1154,6 +1168,10 @@ | ||
87 | *pproc = (int (*)()) &_sasl_getpath; | ||
88 | *pcontext = NULL; | ||
89 | return SASL_OK; | ||
90 | + case SASL_CB_GETCONFPATH: | ||
91 | + *pproc = (int (*)()) &_sasl_getconfpath; | ||
92 | + *pcontext = NULL; | ||
93 | + return SASL_OK; | ||
94 | case SASL_CB_AUTHNAME: | ||
95 | *pproc = (int (*)()) &_sasl_getsimple; | ||
96 | *pcontext = conn; | ||
97 | @@ -1498,6 +1516,30 @@ | ||
98 | |||
99 | return &default_getpath_cb; | ||
100 | } | ||
101 | + | ||
102 | +const sasl_callback_t * | ||
103 | +_sasl_find_getconfpath_callback(const sasl_callback_t *callbacks) | ||
104 | +{ | ||
105 | + static const sasl_callback_t default_getconfpath_cb = { | ||
106 | + SASL_CB_GETCONFPATH, | ||
107 | + &_sasl_getconfpath, | ||
108 | + NULL | ||
109 | + }; | ||
110 | + | ||
111 | + if (callbacks) | ||
112 | + while (callbacks->id != SASL_CB_LIST_END) | ||
113 | + { | ||
114 | + if (callbacks->id == SASL_CB_GETCONFPATH) | ||
115 | + { | ||
116 | + return callbacks; | ||
117 | + } else { | ||
118 | + ++callbacks; | ||
119 | + } | ||
120 | + } | ||
121 | + | ||
122 | + return &default_getconfpath_cb; | ||
123 | +} | ||
124 | + | ||
125 | |||
126 | const sasl_callback_t * | ||
127 | _sasl_find_verifyfile_callback(const sasl_callback_t *callbacks) | ||
128 | diff -urN cyrus-sasl-2.1.17.orig/lib/saslint.h cyrus-sasl-2.1.17/lib/saslint.h | ||
129 | --- cyrus-sasl-2.1.17.orig/lib/saslint.h Wed Mar 29 06:45:21 2000 | ||
130 | +++ cyrus-sasl-2.1.17/lib/saslint.h Thu Jun 1 12:56:37 2000 | ||
131 | @@ -360,6 +360,9 @@ | ||
132 | _sasl_find_getpath_callback(const sasl_callback_t *callbacks); | ||
133 | |||
134 | extern const sasl_callback_t * | ||
135 | +_sasl_find_getconfpath_callback(const sasl_callback_t *callbacks); | ||
136 | + | ||
137 | +extern const sasl_callback_t * | ||
138 | _sasl_find_verifyfile_callback(const sasl_callback_t *callbacks); | ||
139 | |||
140 | extern int _sasl_common_init(sasl_global_callbacks_t *global_callbacks); | ||
141 | diff -urN cyrus-sasl-2.1.17.orig/lib/server.c cyrus-sasl-2.1.17/lib/server.c | ||
142 | --- cyrus-sasl-2.1.17.orig/lib/server.c Tue May 9 19:52:53 2000 | ||
143 | +++ cyrus-sasl-2.1.17/lib/server.c Thu Jun 1 12:59:03 2000 | ||
144 | @@ -462,7 +462,7 @@ | ||
145 | size_t path_len; | ||
146 | char *config_filename=NULL; | ||
147 | size_t len; | ||
148 | - const sasl_callback_t *getpath_cb=NULL; | ||
149 | + const sasl_callback_t *getconfpath_cb=NULL; | ||
150 | |||
151 | /* If appname was not provided, behave as if there is no config file | ||
152 | (see also sasl_config_init() */ | ||
153 | @@ -471,12 +471,12 @@ | ||
154 | } | ||
155 | |||
156 | /* get the path to the plugins; for now the config file will reside there */ | ||
157 | - getpath_cb=_sasl_find_getpath_callback( global_callbacks.callbacks ); | ||
158 | - if (getpath_cb==NULL) return SASL_BADPARAM; | ||
159 | + getconfpath_cb=_sasl_find_getconfpath_callback( global_callbacks.callbacks ); | ||
160 | + if (getconfpath_cb==NULL) return SASL_BADPARAM; | ||
161 | |||
162 | - /* getpath_cb->proc MUST be a sasl_getpath_t; if only c had a type | ||
163 | + /* getconfpath_cb->proc MUST be a sasl_getconfpath_t; if only c had a type | ||
164 | system */ | ||
165 | - result = ((sasl_getpath_t *)(getpath_cb->proc))(getpath_cb->context, | ||
166 | + result = ((sasl_getconfpath_t *)(getconfpath_cb->proc))(getconfpath_cb->context, | ||
167 | &path_to_config); | ||
168 | if (result!=SASL_OK) goto done; | ||
169 | if (path_to_config == NULL) path_to_config = ""; | ||
170 | diff -urN cyrus-sasl-2.1.17.orig/man/sasl_getconfpath_t.3 cyrus-sasl-2.1.17/man/sasl_getconfpath_t.3 | ||
171 | --- cyrus-sasl-2.1.17.orig/man/sasl_getconfpath_t.3 Thu Jan 1 01:00:00 1970 | ||
172 | +++ cyrus-sasl-2.1.17/man/sasl_getconfpath_t.3 Thu Jun 1 13:54:07 2000 | ||
173 | @@ -0,0 +1,47 @@ | ||
174 | +.\" Hey Emacs! This file is -*- nroff -*- source. | ||
175 | +.\" | ||
176 | +.\" This manpage is Copyright (C) 1999 Tim Martin | ||
177 | +.\" | ||
178 | +.\" Permission is granted to make and distribute verbatim copies of this | ||
179 | +.\" manual provided the copyright notice and this permission notice are | ||
180 | +.\" preserved on all copies. | ||
181 | +.\" | ||
182 | +.\" Permission is granted to copy and distribute modified versions of this | ||
183 | +.\" manual under the conditions for verbatim copying, provided that the | ||
184 | +.\" entire resulting derived work is distributed under the terms of a | ||
185 | +.\" permission notice identical to this one | ||
186 | +.\" | ||
187 | +.\" Formatted or processed versions of this manual, if unaccompanied by | ||
188 | +.\" the source, must acknowledge the copyright and authors of this work. | ||
189 | +.\" | ||
190 | +.\" | ||
191 | +.TH sasl_getpath_t "26 March 2000" SASL "SASL man pages" | ||
192 | +.SH NAME | ||
193 | +sasl_getconfpath_t \- The SASL callback to indicate location of the config files | ||
194 | + | ||
195 | + | ||
196 | +.SH SYNOPSIS | ||
197 | +.nf | ||
198 | +.B #include <sasl.h> | ||
199 | + | ||
200 | +.sp | ||
201 | +.BI "int sasl_getconfpath_t(void " *context ", " | ||
202 | +.BI " char ** " path ")"; | ||
203 | + | ||
204 | +.fi | ||
205 | +.SH DESCRIPTION | ||
206 | + | ||
207 | +.B sasl_getconfpath_t | ||
208 | +is used if the application wishes to use a different location for the SASL cofiguration files. If this callback is not used SASL will either use the location in the enviornment variable SASL_CONF_PATH or /etc/sasl by default. | ||
209 | +.PP | ||
210 | + | ||
211 | +.SH "RETURN VALUE" | ||
212 | + | ||
213 | +SASL callback functions should return SASL return codes. See sasl.h for a complete list. SASL_OK indicates success. | ||
214 | + | ||
215 | +.SH "CONFORMING TO" | ||
216 | +RFC 2222 | ||
217 | +.SH "SEE ALSO" | ||
218 | +.BR other sasl stuff | ||
219 | +.BR | ||
220 | +.BR | ||
221 | \ No newline at end of file | ||
222 | diff -urN cyrus-sasl-2.1.17.orig/win32/include/config.h cyrus-sasl-2.1.17/win32/include/config.h | ||
223 | --- cyrus-sasl-2.1.17.orig/win32/include/config.h Tue May 9 19:52:53 2000 | ||
224 | +++ cyrus-sasl-2.1.17/win32/include/config.h Thu Jun 1 13:07:47 2000 | ||
225 | @@ -91,7 +91,9 @@ | ||
226 | #define HAVE_MEMCPY 1 | ||
227 | |||
228 | #define SASL_PATH_ENV_VAR "SASL_PATH" | ||
229 | +#define SASL_CONF_PATH_ENV_VAR "SASL_CONF_PATH" | ||
230 | #define PLUGINDIR "C:\\CMU\\bin\\sasl2" | ||
231 | +#define CONFIGDIR "C:\\CMU\\config\\sasl2" | ||
232 | |||
233 | /* Windows calls these functions something else | ||
234 | */ | ||
235 |