summaryrefslogtreecommitdiff
path: root/libmu_scm
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2002-08-13 13:24:57 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2002-08-13 13:24:57 +0000
commit3373742327451a83f03946e47d0dd512295303f0 (patch)
tree469cb5f2d4cb478bc0eacfa17c90108e68cae73c /libmu_scm
parent257c5cdac7638dc2e7b4d2ada0c4c336fd178ff7 (diff)
downloadmailutils-3373742327451a83f03946e47d0dd512295303f0.tar.gz
mailutils-3373742327451a83f03946e47d0dd512295303f0.tar.bz2
Switched to the new authentication/authorization functions.
Diffstat (limited to 'libmu_scm')
-rw-r--r--libmu_scm/mu_util.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/libmu_scm/mu_util.c b/libmu_scm/mu_util.c
index 606256c6f..0b973fed4 100644
--- a/libmu_scm/mu_util.c
+++ b/libmu_scm/mu_util.c
@@ -16,54 +16,52 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "mu_scm.h"
-#include <pwd.h>
+#include <mailutils/mu_auth.h>
-SCM_DEFINE (mu_scm_getpwuid, "mu_getpwuid", 0, 1, 0,
+SCM_DEFINE (mu_scm_getpwuid, "mu-getpwuid", 1, 0, 0,
(SCM USER),
"Look up an entry in the user database. USER can be an integer,\n"
- "a string, or omitted, giving the behaviour of mu_getpwuid, mu_getpwnam\n"
- "or (system) getpwent respectively.\n"
- "Returns a vector with fields corresponding to those of the passwd\n"
+ "or a string, giving the behaviour of mu_get_auth_by_uid or mu_get_auth_by_name\n"
+ "respectively.\n"
+ "Returns a vector with fields corresponding to those of the mu_auth_data\n"
"entry in question. If no matching entry was found, returns #f.\n")
#define FUNC_NAME s_mu_scm_getpwuid
{
SCM result;
- struct passwd *entry;
+ struct mu_auth_data *entry;
SCM *ve;
- result = scm_make_vector (SCM_MAKINUM (7), SCM_UNSPECIFIED);
+ result = scm_make_vector (SCM_MAKINUM (8), SCM_UNSPECIFIED);
ve = SCM_VELTS (result);
- if (SCM_UNBNDP (USER) || SCM_FALSEP (USER))
+ if (SCM_INUMP (USER))
{
- entry = getpwent ();
- }
- else if (SCM_INUMP (USER))
- {
- entry = mu_getpwuid (SCM_INUM (USER));
+ entry = mu_get_auth_by_uid (SCM_INUM (USER));
}
else
{
SCM_VALIDATE_ROSTRING (1, USER);
if (SCM_SUBSTRP (USER))
USER = scm_makfromstr (SCM_ROCHARS (USER), SCM_ROLENGTH (USER), 0);
- entry = mu_getpwnam (SCM_ROCHARS (USER));
+ entry = mu_get_auth_by_name (SCM_ROCHARS (USER));
}
if (!entry)
return SCM_BOOL_F;
- ve[0] = scm_makfrom0str (entry->pw_name);
- ve[1] = scm_makfrom0str (entry->pw_passwd);
- ve[2] = scm_ulong2num ((unsigned long) entry->pw_uid);
- ve[3] = scm_ulong2num ((unsigned long) entry->pw_gid);
- ve[4] = scm_makfrom0str (entry->pw_gecos);
- if (!entry->pw_dir)
+ ve[0] = scm_makfrom0str (entry->name);
+ ve[1] = scm_makfrom0str (entry->passwd);
+ ve[2] = scm_ulong2num ((unsigned long) entry->uid);
+ ve[3] = scm_ulong2num ((unsigned long) entry->gid);
+ ve[4] = scm_makfrom0str (entry->gecos);
+ if (!entry->dir)
ve[5] = scm_makfrom0str ("");
else
- ve[5] = scm_makfrom0str (entry->pw_dir);
- if (!entry->pw_shell)
+ ve[5] = scm_makfrom0str (entry->dir);
+ if (!entry->shell)
ve[6] = scm_makfrom0str ("");
else
- ve[6] = scm_makfrom0str (entry->pw_shell);
+ ve[6] = scm_makfrom0str (entry->shell);
+ ve[7] = scm_makfrom0str (entry->mailbox);
+ mu_auth_data_free (entry);
return result;
}
#undef FUNC_NAME

Return to:

Send suggestions and report system problems to the System administrator.