Commit 51a78b3d 51a78b3d5d4d5c9407c0c2ad7d3d1a93f46cac03 by Sergey Poznyakoff

new functions: mu_getpwnam() and mu_register_getpwnam(). Removed inclusion of MySql.h

1 parent 5a3b38eb
...@@ -31,10 +31,6 @@ ...@@ -31,10 +31,6 @@
31 31
32 #include <mailutils/mutil.h> 32 #include <mailutils/mutil.h>
33 33
34 #ifdef HAVE_MYSQL
35 #include "../MySql/MySql.h"
36 #endif
37
38 /* convert a sequence of hex characters into an integer */ 34 /* convert a sequence of hex characters into an integer */
39 35
40 unsigned long mu_hex2ul(char hex) 36 unsigned long mu_hex2ul(char hex)
...@@ -297,11 +293,7 @@ mu_tilde_expansion (const char *ref, const char *delim, const char *homedir) ...@@ -297,11 +293,7 @@ mu_tilde_expansion (const char *ref, const char *delim, const char *homedir)
297 name = calloc (s - p + 1, 1); 293 name = calloc (s - p + 1, 1);
298 memcpy (name, p, s - p); 294 memcpy (name, p, s - p);
299 name [s - p] = '\0'; 295 name [s - p] = '\0';
300 pw = getpwnam (name); 296 pw = mu_getpwnam (name);
301 #ifdef HAVE_MYSQL
302 if (!pw)
303 pw = getMpwnam(name);
304 #endif /* HAVE_MYSQL */
305 free (name); 297 free (name);
306 if (pw) 298 if (pw)
307 { 299 {
...@@ -332,3 +324,23 @@ util_cpystr (char *dst, const char *src, size_t size) ...@@ -332,3 +324,23 @@ util_cpystr (char *dst, const char *src, size_t size)
332 dst[len] = '\0'; 324 dst[len] = '\0';
333 return len; 325 return len;
334 } 326 }
327
328 static struct passwd *(*_app_getpwnam) __P((char *)) = NULL;
329
330 void
331 mu_register_getpwnam (struct passwd *(*fun) __P((char *)))
332 {
333 _app_getpwnam = fun;
334 }
335
336 struct password *
337 mu_getpwnam (const char *name)
338 {
339 struct password *p;
340
341 p = getpwnam (name);
342 if (!p && _app_getpwnam)
343 p = (*_app_getpwnam)(name);
344 return p;
345 }
346
......