[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 03/21: trans: fix the receiver lookup in password
From: |
Samuel Thibault |
Subject: |
[hurd] 03/21: trans: fix the receiver lookup in password |
Date: |
Tue, 04 Feb 2014 17:25:27 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 2845394f72e2733f96621a1f02f1b943e62c0964
Author: Justus Winter <address@hidden>
Date: Thu Nov 28 16:34:31 2013 +0100
trans: fix the receiver lookup in password
Use translation functions instead of doing the lookup manually.
* trans/Makefile (password-MIGSFLAGS): Add mutators.
* trans/password.c (S_password_check_user): Update accordingly.
(S_password_check_group): Likewise.
---
trans/Makefile | 6 +++++-
trans/password.c | 30 ++++++++++++++++++------------
2 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/trans/Makefile b/trans/Makefile
index 291df2f..c0386d0 100644
--- a/trans/Makefile
+++ b/trans/Makefile
@@ -1,6 +1,6 @@
#
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2006, 2007,
-# 2008 Free Software Foundation, Inc.
+# 2008, 2013 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
@@ -32,6 +32,10 @@ OBJS = $(SRCS:.c=.o) fsysServer.o ifsockServer.o
passwordServer.o \
HURDLIBS = ports netfs trivfs iohelp fshelp pipe ihash shouldbeinlibc
LDLIBS += -lpthread
password-LDLIBS = $(LIBCRYPT)
+password-MIGSFLAGS=\
+ "-DIO_INTRAN=trivfs_protid_t trivfs_begin_using_protid (io_t)" \
+ "-DIO_DESTRUCTOR=trivfs_end_using_protid (trivfs_protid_t)" \
+ "-DPASSWORD_IMPORTS=import <hurd/trivfs.h>;"
include ../Makeconf
diff --git a/trans/password.c b/trans/password.c
index 6f15a9e..344b78b 100644
--- a/trans/password.c
+++ b/trans/password.c
@@ -1,5 +1,5 @@
/* Hurd standard password server.
- Copyright (C) 1999 Free Software Foundation
+ Copyright (C) 1999, 2013 Free Software Foundation
Written by Mark Kettenis.
The GNU Hurd is free software; you can redistribute it and/or
@@ -135,10 +135,9 @@ trivfs_goaway (struct trivfs_control *fsys, int flags)
/* Implement password_check_user as described in <hurd/password.defs>. */
kern_return_t
-S_password_check_user (io_t server, uid_t user, char *pw,
+S_password_check_user (struct trivfs_protid *cred, uid_t user, char *pw,
mach_port_t *port, mach_msg_type_name_t *port_type)
{
- struct trivfs_protid *cred;
struct ugids ugids = UGIDS_INIT;
auth_t auth;
error_t err;
@@ -150,10 +149,16 @@ S_password_check_user (io_t server, uid_t user, char *pw,
return strdup (pw);
}
- cred = ports_lookup_port (port_bucket, server, trivfs_protid_portclasses[0]);
if (! cred)
return EOPNOTSUPP;
+ if (cred->pi.bucket != port_bucket ||
+ cred->pi.class != trivfs_protid_portclasses[0])
+ {
+ ports_port_deref (cred);
+ return EOPNOTSUPP;
+ }
+
/* Verify password. */
err = ugids_add_user (&ugids, user, 1);
if (!err)
@@ -173,17 +178,14 @@ S_password_check_user (io_t server, uid_t user, char *pw,
}
ugids_fini (&ugids);
-
- ports_port_deref (cred);
return err;
}
/* Implement password_check_group as described in <hurd/password.defs>. */
kern_return_t
-S_password_check_group (io_t server, uid_t group, char *pw,
+S_password_check_group (struct trivfs_protid *cred, uid_t group, char *pw,
mach_port_t *port, mach_msg_type_name_t *port_type)
{
- struct trivfs_protid *cred;
struct ugids ugids = UGIDS_INIT;
auth_t auth;
error_t err;
@@ -195,10 +197,16 @@ S_password_check_group (io_t server, uid_t group, char
*pw,
return strdup (pw);
}
- cred = ports_lookup_port (port_bucket, server, trivfs_protid_portclasses[0]);
if (! cred)
return EOPNOTSUPP;
-
+
+ if (cred->pi.bucket != port_bucket ||
+ cred->pi.class != trivfs_protid_portclasses[0])
+ {
+ ports_port_deref (cred);
+ return EOPNOTSUPP;
+ }
+
/* Verify password. */
err = ugids_add_gid (&ugids, group, 1);
if (!err)
@@ -218,7 +226,5 @@ S_password_check_group (io_t server, uid_t group, char *pw,
}
ugids_fini (&ugids);
-
- ports_port_deref (cred);
return err;
}
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 05/21: libnetfs: include the mig-generated server headers in demuxer.c, (continued)
- [hurd] 05/21: libnetfs: include the mig-generated server headers in demuxer.c, Samuel Thibault, 2014/02/04
- [hurd] 16/21: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/02/04
- [hurd] 15/21: Make pfinet re-open ethernet device on transmission error, Samuel Thibault, 2014/02/04
- [hurd] 13/21: proc: fix the receiver lookup in S_proc_exception_raise, Samuel Thibault, 2014/02/04
- [hurd] 21/21: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2014/02/04
- [hurd] 04/21: libdiskfs: include the mig-generated server headers in demuxer.c, Samuel Thibault, 2014/02/04
- [hurd] 17/21: Also re-open Ethernet device on EMIG_SERVER_DIED, Samuel Thibault, 2014/02/04
- [hurd] 08/21: proc: include the mig-generated server headers in main.c, Samuel Thibault, 2014/02/04
- [hurd] 19/21: Fix crash on fsysopts when pfinet has no IPv6, Samuel Thibault, 2014/02/04
- [hurd] 09/21: pfinet: include the mig-generated server headers in main.c, Samuel Thibault, 2014/02/04
- [hurd] 03/21: trans: fix the receiver lookup in password,
Samuel Thibault <=
- [hurd] 10/21: pflocal: include the mig-generated server headers, Samuel Thibault, 2014/02/04
- [hurd] 07/21: exec: include the mig-generated server headers in main.c, Samuel Thibault, 2014/02/04
- [hurd] 02/21: Rename variables with the name "error" to "err"., Samuel Thibault, 2014/02/04
- [hurd] 20/21: daemons/getty: display /etc/issue if available, Samuel Thibault, 2014/02/04
- [hurd] 01/21: libps: fix task/thread times fetching, Samuel Thibault, 2014/02/04
- [hurd] 11/21: auth: include the mig-generated server headers in auth.c, Samuel Thibault, 2014/02/04
- [hurd] 18/21: pfinet: really deallocate device port, Samuel Thibault, 2014/02/04
- [hurd] 14/21: libnetfs: fix file locking on peropen release, Samuel Thibault, 2014/02/04