> Perhaps iohelp should have a convenience function to create an iouser
> for root, or any one-uid, one-gid iouser. Then those two places you
> mention would just have iohelp_create_iouser_oneid (0, 0) in their call
> to make_protid.
I have added several convenience function and revised the source
appropriately. It also uses a new calling convention making
not checking for errors difficult, however, this is at the cost
of ABI incompatibility, however, I feel that this is worth it.
/* Create a new IOUSER in USER for the specified idvecs */
error_t iohelp_create_iouser (struct iouser **user,
struct idvec *uids,
struct idvec *gids);
/* Create a new IOUSER in USER for the specified arrays. */
error_t iohelp_create_complex_iouser (struct iouser **user,
uid_t *uids, int nuids,
gid_t *gids, int ngids);
/* Create a new IOUSER in USER for the specified uid and gid. */
error_t iohelp_create_simple_iouser (struct iouser **user,
uid_t uid, gid_t gid);
/* Create a new IOUSER in USER with no identity. */
error_t iohelp_create_empty_iouser (struct iouser **user);
I have also revised the other iohelp calls that return an iouser.
If this is a reasonable change, I would like to do the same
type of change to diskfs_make_protid, diskfs_make_peropen etc.
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/libiohelp/ChangeLog
hurd-20010329-iohelp/libiohelp/ChangeLog
--- hurd-20010329-snapshot/libiohelp/ChangeLog Sun Jul 11 04:05:42 1999
+++ hurd-20010329-iohelp/libiohelp/ChangeLog Sun Apr 1 05:47:05 2001
@@ -1,3 +1,20 @@
+2001-04-01 Neal H Walfield <[EMAIL PROTECTED]>
+
+ * iohelp.h (iohelp_create_iouser): Change declaration
+ such that as error_t is now returned and the iouser is
+ a parameter.
+ (iohelp_create_empty_iouser): New funtion.
+ (iohelp_create_simple_iouser): New function.
+ (iohelp_create_complex_iouser): New funtion.
+
+ * iouser-create.c (iohelp_create_iouser): Implement new
+ semantics.
+ (iohelp_create_empty_iouser): Implement new function.
+ (iohelp_create_simple_iouser): Implement new function.
+ (iohelp_create_complex_iouser): Implement new function.
+ * iouser-dup.c (iohelp_dup_iouser): Implement new semantics.
+ * iouser-reauth.c (iohelp_reauth): Implement new semantics.
+
1999-07-11 Thomas Bushnell, BSG <[EMAIL PROTECTED]>
* return-buffer.c: Include <sys/mman.h>.
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/libiohelp/iohelp.h
hurd-20010329-iohelp/libiohelp/iohelp.h
--- hurd-20010329-snapshot/libiohelp/iohelp.h Thu Aug 20 01:56:35 1998
+++ hurd-20010329-iohelp/libiohelp/iohelp.h Sun Apr 1 04:49:35 2001
@@ -1,5 +1,5 @@
/* Library providing helper functions for io servers.
- Copyright (C) 1993, 94, 96, 98 Free Software Foundation, Inc.
+ Copyright (C) 1993,94,96,98,2001 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
@@ -75,24 +75,38 @@
void *hook; /* Never used by iohelp library */
};
-/* Return a copy of IOUSER. */
-struct iouser *iohelp_dup_iouser (struct iouser *iouser);
+/* Return a copy of IOUSER in CLONE. */
+error_t iohelp_dup_iouser (struct iouser **clone, struct iouser *iouser);
/* Free a reference to IOUSER. */
void iohelp_free_iouser (struct iouser *iouser);
-/* Create a new IOUSER for the specified idvecs */
-struct iouser *iohelp_create_iouser (struct idvec *uids, struct idvec *gids);
+/* Create a new IOUSER in USER for the specified idvecs */
+error_t iohelp_create_iouser (struct iouser **user, struct idvec *uids,
+ struct idvec *gids);
+
+/* Create a new IOUSER in USER for the specified arrays. */
+error_t iohelp_create_complex_iouser (struct iouser **user,
+ uid_t *uids, int nuids,
+ gid_t *gids, int ngids);
+
+/* Create a new IOUSER in USER for the specified uid and gid. */
+error_t iohelp_create_simple_iouser (struct iouser **user, uid_t uid,
+ gid_t gid);
-/* Conduct a reauthentication transaction, returning a new iouser.
- AUTHSERVER is the I/O servers auth port. The rendezvous port
+/* Create a new IOUSER in USER with no identity. */
+error_t iohelp_create_empty_iouser (struct iouser **user);
+
+/* Conduct a reauthentication transaction, returning a new iouser in
+ USER. AUTHSERVER is the I/O servers auth port. The rendezvous port
provided by the user is REND_PORT. If the transaction cannot be
completed, return zero, unless PERMIT_FAILURE is non-zero. If
PERMIT_FAILURE is nonzero, then should the transaction fail, return
an iouser that has no ids. The new port to be sent to the user is
newright. */
-struct iouser *iohelp_reauth (auth_t authserver, mach_port_t rend_port,
- mach_port_t newright, int permit_failure);
+error_t iohelp_reauth (struct iouser **user, auth_t authserver,
+ mach_port_t rend_port, mach_port_t newright,
+ int permit_failure);
/* Puts data from the malloced buffer BUF, LEN bytes long, into RBUF & RLEN,
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libiohelp/iouser-create.c
hurd-20010329-iohelp/libiohelp/iouser-create.c
--- hurd-20010329-snapshot/libiohelp/iouser-create.c Mon Nov 18 18:48:01 1996
+++ hurd-20010329-iohelp/libiohelp/iouser-create.c Sun Apr 1 08:02:45 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1996 Free Software Foundation
+ Copyright (C) 1996,2001 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -17,17 +17,95 @@
#include "iohelp.h"
-struct iouser *
-iohelp_create_iouser (struct idvec *uids, struct idvec *gids)
+error_t
+iohelp_create_iouser (struct iouser **user, struct idvec *uids,
+ struct idvec *gids)
{
struct iouser *new;
new = malloc (sizeof (struct iouser));
if (!new)
- return 0;
+ return ENOMEM;
+ *user = new;
new->uids = uids;
new->gids = gids;
new->hook = 0;
- return new;
+
+ return 0;
}
+#define E(err) \
+ do { \
+ if (err) \
+ { \
+ if (! uids) \
+ return err; \
+ idvec_free (uids); \
+ if (! gids) \
+ return err; \
+ idvec_free (gids); \
+ return err; \
+ } \
+ } while (0)
+
+error_t
+iohelp_create_empty_iouser (struct iouser **user)
+{
+ struct idvec *uids, *gids;
+
+ uids = make_idvec ();
+ if (! uids)
+ E (ENOMEM);
+
+ gids = make_idvec ();
+ if (! gids)
+ E (ENOMEM);
+
+ E (iohelp_create_iouser (user, uids, gids));
+
+ return 0;
+}
+
+error_t
+iohelp_create_simple_iouser (struct iouser **user, uid_t uid, gid_t gid)
+{
+ struct idvec *uids, *gids;
+
+ uids = make_idvec ();
+ if (! uids)
+ E (ENOMEM);
+
+ gids = make_idvec ();
+ if (! gids)
+ E (ENOMEM);
+
+ E (idvec_add (uids, uid));
+ E (idvec_add (gids, gid));
+
+ E (iohelp_create_iouser (user, uids, gids));
+
+ return 0;
+}
+
+error_t
+iohelp_create_complex_iouser (struct iouser **user,
+ uid_t *uvec, int nuids,
+ gid_t *gvec, int ngids)
+{
+ struct idvec *uids, *gids;
+
+ uids = make_idvec ();
+ if (! uids)
+ E (ENOMEM);
+
+ gids = make_idvec ();
+ if (! gids)
+ E (ENOMEM);
+
+ E (idvec_set_ids (uids, uvec, nuids));
+ E (idvec_set_ids (gids, gvec, ngids));
+
+ E (iohelp_create_iouser (user, uids, gids));
+
+ return 0;
+}
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libiohelp/iouser-dup.c
hurd-20010329-iohelp/libiohelp/iouser-dup.c
--- hurd-20010329-snapshot/libiohelp/iouser-dup.c Mon Nov 18 18:48:05 1996
+++ hurd-20010329-iohelp/libiohelp/iouser-dup.c Sun Apr 1 05:44:20 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1996 Free Software Foundation
+ Copyright (C) 1996,2001 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -17,21 +17,24 @@
#include "iohelp.h"
-struct iouser *
-iohelp_dup_iouser (struct iouser *iouser)
+error_t
+iohelp_dup_iouser (struct iouser **clone, struct iouser *iouser)
{
struct iouser *new;
error_t err = 0;
new = malloc (sizeof (struct iouser));
if (!new)
- return 0;
+ return ENOMEM;
new->uids = make_idvec ();
new->gids = make_idvec ();
new->hook = 0;
if (!new->uids || !new->gids)
- goto lose;
+ {
+ err = ENOMEM;
+ goto lose;
+ }
err = idvec_set (new->uids, iouser->uids);
if (!err)
@@ -45,7 +48,9 @@
if (new->gids)
idvec_free (new->gids);
free (new);
- return 0;
+ return err;
}
- return new;
+
+ *clone = new;
+ return 0;
}
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libiohelp/iouser-reauth.c
hurd-20010329-iohelp/libiohelp/iouser-reauth.c
--- hurd-20010329-snapshot/libiohelp/iouser-reauth.c Sun Jul 11 04:05:43 1999
+++ hurd-20010329-iohelp/libiohelp/iouser-reauth.c Sun Apr 1 05:47:22 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1996, 1999 Free Software Foundation
+ Copyright (C) 1996,99,2001 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -26,8 +26,9 @@
PERMIT_FAILURE is nonzero, then should the transaction fail, return
an iouser that has no ids. The new port to be sent to the user is
newright. */
-struct iouser *iohelp_reauth (auth_t authserver, mach_port_t rend_port,
- mach_port_t newright, int permit_failure)
+error_t iohelp_reauth (struct iouser **user,
+ auth_t authserver, mach_port_t rend_port,
+ mach_port_t newright, int permit_failure)
{
uid_t gubuf[20], ggbuf[20], aubuf[20], agbuf[20];
uid_t *gen_uids, *gen_gids, *aux_uids, *aux_gids;
@@ -37,7 +38,7 @@
new = malloc (sizeof (struct iouser));
if (!new)
- return 0;
+ return ENOMEM;
new->uids = make_idvec ();
new->gids = make_idvec ();
@@ -48,7 +49,7 @@
if (new->gids)
idvec_free (new->gids);
free (new);
- return 0;
+ return ENOMEM;
}
genuidlen = gengidlen = auxuidlen = auxgidlen = 20;
@@ -96,7 +97,9 @@
idvec_free (new->uids);
idvec_free (new->gids);
free (new);
- return 0;
+ return err;
}
- return new;
+
+ *user = new;
+ return 0;
}
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/exec/ChangeLog
hurd-20010329-iohelp/exec/ChangeLog
--- hurd-20010329-snapshot/exec/ChangeLog Mon Feb 12 17:18:55 2001
+++ hurd-20010329-iohelp/exec/ChangeLog Sun Apr 1 04:44:00 2001
@@ -1,3 +1,7 @@
+2001-04-01 Neal H Walfield <[EMAIL PROTECTED]>
+
+ * main.c (S_exec_init): Use iohelp_create_empty_iouser.
+
2001-02-12 Marcus Brinkmann <[EMAIL PROTECTED]>
* main.c: Change hurd version name from proc to exec.
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/exec/main.c
hurd-20010329-iohelp/exec/main.c
--- hurd-20010329-snapshot/exec/main.c Mon Feb 12 17:18:55 2001
+++ hurd-20010329-iohelp/exec/main.c Sun Apr 1 04:44:06 2001
@@ -1,6 +1,6 @@
/* GNU Hurd standard exec server, main program and server mechanics.
- Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000 Free Software Foundation,
Inc.
+ Copyright (C) 1992,93,94,95,96,97,98,99,2000,01 Free Software Foundation, Inc.
Written by Roland McGrath.
This file is part of the GNU Hurd.
@@ -226,12 +226,13 @@
change. This will generate an immediate callback giving us the
initial boot-time canonical sets. */
{
+ struct iouser *user;
struct trivfs_protid *cred;
mach_port_t right;
- err = trivfs_open (fsys,
- iohelp_create_iouser (make_idvec (), make_idvec ()),
- 0, MACH_PORT_NULL, &cred);
+ err = iohelp_create_empty_iouser (&user);
+ assert_perror (err);
+ err = trivfs_open (fsys, user, 0, MACH_PORT_NULL, &cred);
assert_perror (err);
right = ports_get_send_right (cred);
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/libdiskfs/ChangeLog
hurd-20010329-iohelp/libdiskfs/ChangeLog
--- hurd-20010329-snapshot/libdiskfs/ChangeLog Wed Mar 28 13:06:38 2001
+++ hurd-20010329-iohelp/libdiskfs/ChangeLog Sun Apr 1 05:05:41 2001
@@ -1,3 +1,19 @@
+2001-04-01 Neal H Walfield <[EMAIL PROTECTED]>
+
+ * dir-lookup.c (diskfs_S_dir_lookup): Use
+ iohelp_create_empty_iouser.
+ * fsys-getfile.c (diskfs_S_fsys_getfile): Use
+ iohelp_create_complex_iouser.
+ * io-reauthenticate.c (diskfs_S_io_reauthenticate): Use
+ new iohelp_reauth semantics.
+ * io-restrict-auth.c (diskfs_S_io_restrict_auth): Use
+ new iohelp_create_iouser semantics.
+ * protid-make.c (diskfs_finish_protid): Use
+ iohelp_create_simple_iouser and new iohelp_dup_iouse
+ semantics.
+ * trans-callback.c (_diskfs_translator_callback2_fn):
+ Use iohelp_create_simple_iouser.
+
2001-03-28 Marcus Brinkmann <[EMAIL PROTECTED]>
* dir-lookup.c (diskfs_S_dir_lookup): New variable USER. Store new
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libdiskfs/dir-lookup.c
hurd-20010329-iohelp/libdiskfs/dir-lookup.c
--- hurd-20010329-snapshot/libdiskfs/dir-lookup.c Wed Mar 28 13:06:38 2001
+++ hurd-20010329-iohelp/libdiskfs/dir-lookup.c Sun Apr 1 04:46:47 2001
@@ -248,11 +248,15 @@
/* Create an unauthenticated port for DNP, and then
unlock it. */
- user = iohelp_create_iouser (make_idvec (), make_idvec ());
- error =
- diskfs_create_protid (diskfs_make_peropen (dnp, 0, dircred->po),
- user, &newpi);
- iohelp_free_iouser (user);
+ error = iohelp_create_empty_iouser (&user);
+ if (! error)
+ {
+ error =
+ diskfs_create_protid (diskfs_make_peropen (dnp, 0,
+ dircred->po),
+ user, &newpi);
+ iohelp_free_iouser (user);
+ }
if (error)
goto out;
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libdiskfs/fsys-getfile.c
hurd-20010329-iohelp/libdiskfs/fsys-getfile.c
--- hurd-20010329-snapshot/libdiskfs/fsys-getfile.c Mon Dec 13 19:59:38 1999
+++ hurd-20010329-iohelp/libdiskfs/fsys-getfile.c Sun Apr 1 04:53:13 2001
@@ -1,6 +1,6 @@
/* Return the file for a given handle (for nfs server support)
- Copyright (C) 1997,99 Free Software Foundation, Inc.
+ Copyright (C) 1997,99,2001 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -39,7 +39,6 @@
struct node *node;
const union diskfs_fhandle *f;
struct protid *new_cred;
- struct idvec *uvec, *gvec;
struct iouser *user;
struct port_info *pt =
ports_lookup_port (diskfs_port_bucket, fsys, diskfs_control_class);
@@ -69,12 +68,13 @@
return ESTALE;
}
- uvec = make_idvec ();
- gvec = make_idvec ();
-
- idvec_set_ids (uvec, uids, nuids);
- idvec_set_ids (gvec, gids, ngids);
- user = iohelp_create_iouser (uvec, gvec);
+ err = iohelp_create_complex_iouser (&user, uids, nuids, gids, ngids);
+ if (err)
+ {
+ diskfs_nput (node);
+ ports_port_deref (pt);
+ return err;
+ }
flags = 0;
if (! fshelp_access (&node->dn_stat, S_IREAD, user))
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libdiskfs/io-reauthenticate.c
hurd-20010329-iohelp/libdiskfs/io-reauthenticate.c
--- hurd-20010329-snapshot/libdiskfs/io-reauthenticate.c Wed Mar 28 13:06:38
2001
+++ hurd-20010329-iohelp/libdiskfs/io-reauthenticate.c Sun Apr 1 04:55:55 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994,95,96,2000 Free Software Foundation, Inc.
+ Copyright (C) 1994,95,96,2000,01 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
@@ -47,10 +47,14 @@
newright = ports_get_send_right (newcred);
assert (newright != MACH_PORT_NULL);
- user = iohelp_reauth (diskfs_auth_server_port, rend_port, newright, 1);
- diskfs_finish_protid (newcred, user);
+ err = iohelp_reauth (&user, diskfs_auth_server_port, rend_port,
+ newright, 1);
+ if (! err)
+ {
+ diskfs_finish_protid (newcred, user);
+ iohelp_free_iouser (user);
+ }
- iohelp_free_iouser (user);
mach_port_deallocate (mach_task_self (), rend_port);
mach_port_deallocate (mach_task_self (), newright);
@@ -58,5 +62,5 @@
ports_port_deref (newcred);
- return 0;
+ return err;
}
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libdiskfs/io-restrict-auth.c
hurd-20010329-iohelp/libdiskfs/io-restrict-auth.c
--- hurd-20010329-snapshot/libdiskfs/io-restrict-auth.c Wed Mar 28 13:06:38 2001
+++ hurd-20010329-iohelp/libdiskfs/io-restrict-auth.c Sun Apr 1 08:02:10 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
+ Copyright (C) 1994,95,96,2001 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -24,7 +24,7 @@
{
int i;
for (i = 0; i < n; i++)
- if (list[i] == query)
+ If (list[i] == query)
return 1;
return 0;
}
@@ -39,7 +39,7 @@
gid_t *gids,
u_int ngids)
{
- error_t err;
+ error_t err = 0;
struct idvec *uvec, *gvec;
struct iouser *user;
struct protid *newpi;
@@ -48,26 +48,52 @@
if (!cred)
return EOPNOTSUPP;
- uvec = make_idvec ();
- gvec = make_idvec ();
-
if (idvec_contains (cred->user->uids, 0))
+ /* CRED has root access, and so may use any ids. */
{
- /* CRED has root access, and so may use any ids. */
- idvec_set_ids (uvec, uids, nuids);
- idvec_set_ids (gvec, gids, ngids);
+ err = iohelp_create_complex_iouser (&user, uids, nuids, gids, ngids);
+ if (err)
+ return err;
}
else
{
+ uvec = make_idvec ();
+ if (! uvec)
+ return ENOMEM;
+
+ gvec = make_idvec ();
+ if (! gvec)
+ {
+ idvec_free (uvec);
+ return ENOMEM;
+ }
+
/* Otherwise, use any of the requested ids that CRED already has. */
for (i = 0; i < cred->user->uids->num; i++)
if (listmember (uids, cred->user->uids->ids[i], nuids))
- idvec_add (uvec, cred->user->uids->ids[i]);
+ {
+ err = idvec_add (uvec, cred->user->uids->ids[i]);
+ if (err)
+ goto out;
+ }
for (i = 0; i < cred->user->gids->num; i++)
if (listmember (gids, cred->user->gids->ids[i], ngids))
- idvec_add (gvec, cred->user->gids->ids[i]);
+ {
+ idvec_add (gvec, cred->user->gids->ids[i]);
+ if (err)
+ goto out;
+ }
+
+ err = iohelp_create_iouser (&user, uvec, gvec);
+
+ if (err)
+ {
+ out:
+ idvec_free (uvec);
+ idvec_free (gvec);
+ return err;
+ }
}
- user = iohelp_create_iouser (uvec, gvec);
mutex_lock (&cred->po->np->lock);
err = diskfs_create_protid (cred->po, user, &newpi);
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libdiskfs/protid-make.c
hurd-20010329-iohelp/libdiskfs/protid-make.c
--- hurd-20010329-snapshot/libdiskfs/protid-make.c Mon Nov 18 18:46:27 1996
+++ hurd-20010329-iohelp/libdiskfs/protid-make.c Sun Apr 1 05:03:06 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
+ Copyright (C) 1994,95,96,2001 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -17,6 +17,7 @@
#include "priv.h"
#include <string.h>
+#include <assert.h>
/* Build and return in CRED a protid which has no user identification, for
peropen PO. The node PO->np must be locked. */
@@ -41,20 +42,17 @@
void
diskfs_finish_protid (struct protid *cred, struct iouser *user)
{
+ error_t err;
+
if (!user)
- {
- uid_t zero = 0;
- /* Create one for root */
- user = iohelp_create_iouser (make_idvec (), make_idvec ());
- idvec_set_ids (user->uids, &zero, 1);
- idvec_set_ids (user->gids, &zero, 1);
- cred->user = user;
- }
+ err = iohelp_create_simple_iouser (&cred->user, 0, 0);
else
- cred->user = iohelp_dup_iouser (user);
+ err = iohelp_dup_iouser (&cred->user, user);
+ assert_perror (err);
- mach_port_move_member (mach_task_self (), cred->pi.port_right,
- diskfs_port_bucket->portset);
+ err = mach_port_move_member (mach_task_self (), cred->pi.port_right,
+ diskfs_port_bucket->portset);
+ assert_perror (err);
}
/* Create and return a protid for an existing peropen PO in CRED for USER.
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libdiskfs/trans-callback.c
hurd-20010329-iohelp/libdiskfs/trans-callback.c
--- hurd-20010329-snapshot/libdiskfs/trans-callback.c Wed Mar 28 13:06:38 2001
+++ hurd-20010329-iohelp/libdiskfs/trans-callback.c Sun Apr 1 05:05:43 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,2001 Free Software Foundation, Inc.
Written by Michael I. Bushnell.
This file is part of the GNU Hurd.
@@ -55,14 +55,12 @@
struct node *np = cookie1;
struct protid *cred;
error_t err;
- struct idvec *uids, *gids;
struct iouser *user;
- uids = make_idvec ();
- gids = make_idvec ();
- idvec_set_ids (uids, &np->dn_stat.st_uid, 1);
- idvec_set_ids (gids, &np->dn_stat.st_gid, 1);
- user = iohelp_create_iouser (uids, gids);
+ err = iohelp_create_simple_iouser (&user, np->dn_stat.st_uid,
+ np->dn_stat.st_gid);
+ if (err)
+ return err;
err =
diskfs_create_protid (diskfs_make_peropen (np, flags, cookie2),
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/libnetfs/ChangeLog
hurd-20010329-iohelp/libnetfs/ChangeLog
--- hurd-20010329-snapshot/libnetfs/ChangeLog Mon Jan 29 19:50:24 2001
+++ hurd-20010329-iohelp/libnetfs/ChangeLog Sun Apr 1 09:09:04 2001
@@ -1,3 +1,25 @@
+2001-04-01 Neal H Walfield <[EMAIL PROTECTED]>
+
+ * dir-lookup.c (netfs_S_dir_lookup): Use
+ iohelp_create_empty_iouser. Use iohelp_dup_iouser
+ as per the new semantics.
+ * dir-mkfile.c (netfs_S_dir_mkfile): Use iohelp_dup_iouser
+ as per the new semantics.
+ * file-exec.c (netfs_S_file_exec): Likewise.
+ * file-reparent.c (netfs_S_file_reparent): Likewise.
+ * fsys-getroot.c (netfs_S_fsys_getroot): Use
+ iohelp_create_complex_iouser.
+ * fsys-syncfs.c (netfs_S_fsys_syncfs): Use
+ iohelp_create_simple_iouser.
+ * io-duplicate.c (netfs_S_io_duplicate): Use iohelp_dup_iouser
+ as per the new semantics.
+ * io-reauthenticate.c (netfs_S_io_reauthenticate): Use
+ iohelp_reauth as per the new semantics.
+ * io-restric-auth.c (netfs_S_io_restric_auth): Use
+ iohelp_create_complex_iouser. Check return values.
+ * trans-callback.c (_netfs_transcallback2_fn): Use
+ iohelp_create_simple_iouser.
+
2001-01-15 Neal H Walfield <[EMAIL PROTECTED]>
* netfs.h: Added netfs_get_storage_info.
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/dir-lookup.c hurd-20010329-iohelp/libnetfs/dir-lookup.c
--- hurd-20010329-snapshot/libnetfs/dir-lookup.c Sat Dec 30 13:22:28 2000
+++ hurd-20010329-iohelp/libnetfs/dir-lookup.c Sun Apr 1 06:13:41 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,01 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -48,6 +48,7 @@
char *nextname;
error_t error;
struct protid *newpi;
+ struct iouser *user;
if (!diruser)
return EOPNOTSUPP;
@@ -233,25 +234,37 @@
/* Create an unauthenticated port for DNP, and then
unlock it. */
- newpi =
- netfs_make_protid (netfs_make_peropen (dnp, 0, diruser->po),
- iohelp_create_iouser (make_idvec (),
- make_idvec ()));
- dirport = ports_get_send_right (newpi);
- ports_port_deref (newpi);
-
- error = fshelp_fetch_root (&np->transbox, diruser->po,
- dirport,
- diruser->user,
- lastcomp ? flags : 0,
- ((np->nn_stat.st_mode & S_IPTRANS)
- ? _netfs_translator_callback1
- : short_circuited_callback1),
- _netfs_translator_callback2,
- do_retry, retry_name, retry_port);
- /* fetch_root copies DIRPORT for success, so we always should
- deallocate our send right. */
- mach_port_deallocate (mach_task_self (), dirport);
+ error = iohelp_create_empty_iouser (&user);
+ if (! error)
+ {
+ newpi = netfs_make_protid (netfs_make_peropen (dnp, 0,
+ diruser->po),
+ user);
+ if (! newpi)
+ {
+ iohelp_free_iouser (user);
+ error = ENOMEM;
+ }
+ }
+
+ if (! error)
+ {
+ dirport = ports_get_send_right (newpi);
+ ports_port_deref (newpi);
+
+ error = fshelp_fetch_root (&np->transbox, diruser->po,
+ dirport,
+ diruser->user,
+ lastcomp ? flags : 0,
+ ((np->nn_stat.st_mode & S_IPTRANS)
+ ? _netfs_translator_callback1
+ : short_circuited_callback1),
+ _netfs_translator_callback2,
+ do_retry, retry_name, retry_port);
+ /* fetch_root copies DIRPORT for success, so we always should
+ deallocate our send right. */
+ mach_port_deallocate (mach_task_self (), dirport);
+ }
if (error != ENOENT)
{
@@ -362,8 +375,12 @@
flags &= ~OPENONLY_STATE_MODES;
+ error = iohelp_dup_iouser (&user, diruser->user);
+ if (error)
+ goto out;
+
newpi = netfs_make_protid (netfs_make_peropen (np, flags, diruser->po),
- iohelp_dup_iouser (diruser->user));
+ user);
*retry_port = ports_get_right (newpi);
ports_port_deref (newpi);
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/dir-mkfile.c hurd-20010329-iohelp/libnetfs/dir-mkfile.c
--- hurd-20010329-snapshot/libnetfs/dir-mkfile.c Sun Mar 2 16:13:00 1997
+++ hurd-20010329-iohelp/libnetfs/dir-mkfile.c Sun Apr 1 06:15:39 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,2001 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -28,6 +28,7 @@
{
error_t err;
struct node *np;
+ struct iouser *user;
struct protid *newpi;
mutex_lock (&diruser->po->np->lock);
@@ -37,15 +38,19 @@
{
/* the dir is now unlocked and NP is locked */
flags &= OPENONLY_STATE_MODES;
- newpi = netfs_make_protid (netfs_make_peropen (np, flags, diruser->po),
- iohelp_dup_iouser (diruser->user));
- *newfile = ports_get_right (newpi);
- *newfiletype = MACH_MSG_TYPE_MAKE_SEND;
- ports_port_deref (newpi);
+ err = iohelp_dup_iouser (&user, diruser->user);
+ if (! err)
+ {
+ newpi = netfs_make_protid (netfs_make_peropen (np, flags,
+ diruser->po),
+ user);
+ *newfile = ports_get_right (newpi);
+ *newfiletype = MACH_MSG_TYPE_MAKE_SEND;
+ ports_port_deref (newpi);
+ }
netfs_nput (np);
- return 0;
}
- else
- return err;
+
+ return err;
}
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/file-exec.c hurd-20010329-iohelp/libnetfs/file-exec.c
--- hurd-20010329-snapshot/libnetfs/file-exec.c Fri Mar 17 14:40:42 2000
+++ hurd-20010329-iohelp/libnetfs/file-exec.c Sun Apr 1 06:20:09 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996,97,2000,01 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -122,19 +122,25 @@
if (! err)
{
- struct protid *newpi =
- netfs_make_protid (netfs_make_peropen (np, O_READ, cred->po),
- iohelp_dup_iouser (cred->user));
- right = ports_get_send_right (newpi);
- err = exec_exec (_netfs_exec,
- right, MACH_MSG_TYPE_COPY_SEND,
- task, flags, argv, argvlen, envp, envplen,
- fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
- portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
- intarray, intarraylen, deallocnames, deallocnameslen,
- destroynames, destroynameslen);
- mach_port_deallocate (mach_task_self (), right);
- ports_port_deref (newpi);
+ struct iouser *user;
+ struct protid *newpi;
+
+ err = iohelp_dup_iouser (&user, cred->user);
+ if (! err)
+ {
+ newpi = netfs_make_protid (netfs_make_peropen (np, O_READ, cred->po),
+ user);
+ right = ports_get_send_right (newpi);
+ err = exec_exec (_netfs_exec,
+ right, MACH_MSG_TYPE_COPY_SEND,
+ task, flags, argv, argvlen, envp, envplen,
+ fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
+ portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
+ intarray, intarraylen, deallocnames, deallocnameslen,
+ destroynames, destroynameslen);
+ mach_port_deallocate (mach_task_self (), right);
+ ports_port_deref (newpi);
+ }
}
if (! err)
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/file-reparent.c
hurd-20010329-iohelp/libnetfs/file-reparent.c
--- hurd-20010329-snapshot/libnetfs/file-reparent.c Fri Aug 29 19:11:43 1997
+++ hurd-20010329-iohelp/libnetfs/file-reparent.c Sun Apr 1 06:21:53 2001
@@ -1,8 +1,8 @@
/* Reparent a file
- Copyright (C) 1997 Free Software Foundation
+ Copyright (C) 1997, 2001 Free Software Foundation
- Written by Miles Bader <[EMAIL PROTECTED]>
+ Written by Miles Bader <[EMAIL PROTECTED]>
This file is part of the GNU Hurd.
@@ -26,18 +26,25 @@
netfs_S_file_reparent (struct protid *cred, mach_port_t parent,
mach_port_t *new_file, mach_msg_type_name_t *new_file_type)
{
+ error_t err;
struct node *node;
struct protid *new_cred;
+ struct iouser *user;
if (! cred)
return EOPNOTSUPP;
+ err = iohelp_dup_iouser (&user, cred->user);
+ if (err)
+ return err;
+
node = cred->po->np;
mutex_lock (&node->lock);
+
new_cred =
netfs_make_protid (netfs_make_peropen (node, cred->po->openstat, cred->po),
- iohelp_dup_iouser (cred->user));
+ user);
mutex_unlock (&node->lock);
if (new_cred)
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/fsys-getroot.c
hurd-20010329-iohelp/libnetfs/fsys-getroot.c
--- hurd-20010329-snapshot/libnetfs/fsys-getroot.c Fri Jun 20 01:47:39 1997
+++ hurd-20010329-iohelp/libnetfs/fsys-getroot.c Sun Apr 1 09:54:47 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -41,19 +41,15 @@
error_t err;
struct protid *newpi;
mode_t type;
- struct idvec *uvec, *gvec;
struct peropen peropen_context = { root_parent: dotdot };
if (!pt)
return EOPNOTSUPP;
ports_port_deref (pt);
- uvec = make_idvec ();
- gvec = make_idvec ();
- idvec_set_ids (uvec, uids, nuids);
- idvec_set_ids (gvec, gids, ngids);
-
- cred = iohelp_create_iouser (uvec, gvec);
+ err = iohelp_create_complex_iouser (&cred, uids, nuids, gids, ngids);
+ if (err)
+ return err;
flags &= O_HURD;
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/fsys-syncfs.c
hurd-20010329-iohelp/libnetfs/fsys-syncfs.c
--- hurd-20010329-snapshot/libnetfs/fsys-syncfs.c Wed Nov 20 18:19:37 1996
+++ hurd-20010329-iohelp/libnetfs/fsys-syncfs.c Sun Apr 1 09:53:35 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 2001 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -27,12 +27,11 @@
int children)
{
struct iouser *cred;
- uid_t root = 0;
error_t err;
- cred = iohelp_create_iouser (make_idvec (), make_idvec ());
- idvec_set_ids (cred->uids, &root, 1);
- idvec_set_ids (cred->gids, &root, 1);
+ err = iohelp_create_simple_iouser (&cred, 0, 0);
+ if (err)
+ return err;
err = netfs_attempt_syncfs (cred, wait);
iohelp_free_iouser (cred);
return err;
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/io-duplicate.c
hurd-20010329-iohelp/libnetfs/io-duplicate.c
--- hurd-20010329-snapshot/libnetfs/io-duplicate.c Mon Nov 18 18:50:41 1996
+++ hurd-20010329-iohelp/libnetfs/io-duplicate.c Sun Apr 1 06:29:22 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,2001 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -26,11 +26,16 @@
mach_port_t *newport,
mach_msg_type_name_t *newporttp)
{
+ error_t err;
struct protid *newpi;
+ struct iouser *clone;
+
+ err = iohelp_dup_iouser (&clone, user->user);
+ if (err)
+ return err;
mutex_lock (&user->po->np->lock);
- newpi = netfs_make_protid (user->po,
- iohelp_dup_iouser (user->user));
+ newpi = netfs_make_protid (user->po, clone);
*newport = ports_get_right (newpi);
mutex_unlock (&user->po->np->lock);
*newporttp = MACH_MSG_TYPE_MAKE_SEND;
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/io-reauthenticate.c
hurd-20010329-iohelp/libnetfs/io-reauthenticate.c
--- hurd-20010329-snapshot/libnetfs/io-reauthenticate.c Fri Mar 17 05:31:00 2000
+++ hurd-20010329-iohelp/libnetfs/io-reauthenticate.c Sun Apr 1 06:33:58 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995,96,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,2000,01 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -24,6 +24,7 @@
error_t
netfs_S_io_reauthenticate (struct protid *user, mach_port_t rend_port)
{
+ error_t err;
struct protid *newpi;
mach_port_t newright;
@@ -36,7 +37,8 @@
newright = ports_get_send_right (newpi);
assert (newright != MACH_PORT_NULL);
- newpi->user = iohelp_reauth (netfs_auth_server_port, rend_port, newright, 1);
+ err = iohelp_reauth (&newpi->user, netfs_auth_server_port, rend_port,
+ newright, 1);
mach_port_deallocate (mach_task_self (), rend_port);
mach_port_deallocate (mach_task_self (), newright);
@@ -47,5 +49,5 @@
mutex_unlock (&user->po->np->lock);
ports_port_deref (newpi);
- return 0;
+ return err;
}
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/io-restrict-auth.c
hurd-20010329-iohelp/libnetfs/io-restrict-auth.c
--- hurd-20010329-snapshot/libnetfs/io-restrict-auth.c Mon Nov 18 18:50:56 1996
+++ hurd-20010329-iohelp/libnetfs/io-restrict-auth.c Sun Apr 1 08:25:17 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,2001 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -40,39 +40,77 @@
gid_t *gids,
mach_msg_type_number_t ngids)
{
+ error_t err;
struct idvec *uvec, *gvec;
int i;
struct protid *newpi;
+ struct iouser *new_user;
if (!user)
return EOPNOTSUPP;
- uvec = make_idvec ();
- gvec = make_idvec ();
-
if (idvec_contains (user->user->uids, 0))
{
- idvec_set_ids (uvec, uids, nuids);
- idvec_set_ids (gvec, gids, ngids);
+ err = iohelp_create_complex_iouser (&new_user, uids, nuids, gids, ngids);
+ if (err)
+ return err;
}
else
{
+ uvec = make_idvec ();
+ if (! uvec)
+ return ENOMEM;
+
+ gvec = make_idvec ();
+ if (! gvec)
+ {
+ idvec_free (uvec);
+ return ENOMEM;
+ }
+
for (i = 0; i < user->user->uids->num; i++)
if (listmember (uids, user->user->uids->ids[i], nuids))
- idvec_add (uvec, user->user->uids->ids[i]);
+ {
+ err = idvec_add (uvec, user->user->uids->ids[i]);
+ if (err)
+ goto out;
+ }
for (i = 0; i < user->user->gids->num; i++)
if (listmember (gids, user->user->gids->ids[i], ngids))
- idvec_add (gvec, user->user->gids->ids[i]);
+ {
+ err = idvec_add (gvec, user->user->gids->ids[i]);
+ if (err)
+ goto out;
+ }
+
+ err = iohelp_create_iouser (&new_user, uvec, gvec);
+
+ if (err)
+ {
+ out:
+ idvec_free (uvec);
+ idvec_free (gvec);
+ return err;
+ }
}
mutex_lock (&user->po->np->lock);
- newpi = netfs_make_protid (user->po, iohelp_create_iouser (uvec, gvec));
- *newport = ports_get_right (newpi);
- mutex_unlock (&user->po->np->lock);
+ newpi = netfs_make_protid (user->po, new_user);
+ if (newpi)
+ {
+ *newport = ports_get_right (newpi);
+ mutex_unlock (&user->po->np->lock);
+ *newporttype = MACH_MSG_TYPE_MAKE_SEND;
+ }
+ else
+ {
+ mutex_unlock (&user->po->np->lock);
+ iohelp_free_iouser (new_user);
+ err = ENOMEM;
+ }
- *newporttype = MACH_MSG_TYPE_MAKE_SEND;
ports_port_deref (newpi);
- return 0;
+ return err;
}
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libnetfs/trans-callback.c
hurd-20010329-iohelp/libnetfs/trans-callback.c
--- hurd-20010329-snapshot/libnetfs/trans-callback.c Fri Jun 20 01:45:24 1997
+++ hurd-20010329-iohelp/libnetfs/trans-callback.c Sun Apr 1 08:25:46 2001
@@ -1,6 +1,6 @@
/* Callback functions for starting translators
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,2001 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -51,17 +51,18 @@
mach_port_t *underlying,
mach_msg_type_name_t *underlying_type)
{
+ error_t err;
struct protid *cred;
- struct idvec *uids, *gids;
struct node *node = cookie1;
+ struct iouser *user;
- uids = make_idvec ();
- gids = make_idvec ();
- idvec_set_ids (uids, &node->nn_stat.st_uid, 1);
- idvec_set_ids (gids, &node->nn_stat.st_gid, 1);
+ err = iohelp_create_simple_iouser (&user, node->nn_stat.st_uid,
+ node->nn_stat.st_gid);
+ if (err)
+ return err;
cred = netfs_make_protid (netfs_make_peropen (node, flags, cookie2),
- iohelp_create_iouser (uids, gids));
+ user);
if (cred)
{
*underlying = ports_get_right (cred);
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/libtrivfs/ChangeLog
hurd-20010329-iohelp/libtrivfs/ChangeLog
--- hurd-20010329-snapshot/libtrivfs/ChangeLog Fri Mar 17 12:22:56 2000
+++ hurd-20010329-iohelp/libtrivfs/ChangeLog Sun Apr 1 09:13:03 2001
@@ -1,3 +1,16 @@
+2001-04-01 Neal H Walfield <[EMAIL PROTECTED]>
+
+ * dir-lookup.c (trivfs_S_dir_lookup): Use
+ iohelp_dup_iouser as per the new semantics.
+ * fsys-getroot.c (trivfs_S_fsys_getroot): Use
+ iohelp_create_complex_iouser.
+ * io-reauthenticate.c (trivfs_S_io_reauthenticate):
+ Use iohelp_reauth as per the new semantics.
+ * io-restrict-auth.c (trivfs_S_io_restrict_auth):
+ Use iohelp_create_complex_iouser. Check return values.
+ * trivfs_protid_dup (trivfs_protid_dup): Use iohelp_dup_iouser
+ as per the new semantics.
+
2000-03-17 Thomas Bushnell, BSG <[EMAIL PROTECTED]>
* startup.c (trivfs_startup): Don't use MAKE_SEND in Hurd RPC.
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libtrivfs/dir-lookup.c
hurd-20010329-iohelp/libtrivfs/dir-lookup.c
--- hurd-20010329-snapshot/libtrivfs/dir-lookup.c Mon Oct 11 04:38:02 1999
+++ hurd-20010329-iohelp/libtrivfs/dir-lookup.c Sun Apr 1 06:59:43 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1998, 1999 Free Software Foundation
+ Copyright (C) 1994,98,99,2001 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -64,7 +64,12 @@
err = (*trivfs_check_open_hook) (cred->po->cntl, cred->user, flags);
if (!err)
{
- struct iouser *user = iohelp_dup_iouser (cred->user);
+ struct iouser *user;
+
+ err = iohelp_dup_iouser (&user, cred->user);
+ if (err)
+ return err;
+
err = trivfs_open (cred->po->cntl, user, flags,
cred->realnode, &newcred);
if (err)
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libtrivfs/fsys-getroot.c
hurd-20010329-iohelp/libtrivfs/fsys-getroot.c
--- hurd-20010329-snapshot/libtrivfs/fsys-getroot.c Mon Nov 8 16:52:05 1999
+++ hurd-20010329-iohelp/libtrivfs/fsys-getroot.c Sun Apr 1 07:03:35 2001
@@ -44,7 +44,6 @@
mach_port_t new_realnode;
struct trivfs_protid *cred;
struct iouser *user;
- struct idvec *uvec, *gvec;
if (!cntl)
return EOPNOTSUPP;
@@ -75,11 +74,9 @@
if (err)
return err;
- uvec = make_idvec ();
- gvec = make_idvec ();
- idvec_set_ids (uvec, uids, nuids);
- idvec_set_ids (gvec, gids, ngids);
- user = iohelp_create_iouser (uvec, gvec); /* XXX check return value? */
+ err = iohelp_create_complex_iouser (&user, uids, nuids, gids, ngids);
+ if (err)
+ return err;
/* Validate permissions. */
if (! trivfs_check_access_hook)
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libtrivfs/io-reauthenticate.c
hurd-20010329-iohelp/libtrivfs/io-reauthenticate.c
--- hurd-20010329-snapshot/libtrivfs/io-reauthenticate.c Fri Mar 17 05:29:22
2000
+++ hurd-20010329-iohelp/libtrivfs/io-reauthenticate.c Sun Apr 1 07:09:05 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993,94,95,96,2000 Free Software Foundation, Inc.
+ Copyright (C) 1993,94,95,96,2000,01 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -51,13 +51,15 @@
newright = ports_get_send_right (newcred);
assert (newright != MACH_PORT_NULL);
- newcred->user = iohelp_reauth (auth, rendport, newright, 1);
- if (idvec_contains (newcred->user->uids, 0))
- newcred->isroot = 1;
-
+ err = iohelp_reauth (&newcred->user, auth, rendport, newright, 1);
mach_port_deallocate (mach_task_self (), rendport);
- mach_port_deallocate (mach_task_self (), newright);
mach_port_deallocate (mach_task_self (), auth);
+ if (err)
+ return err;
+
+ mach_port_deallocate (mach_task_self (), newright);
+ if (idvec_contains (newcred->user->uids, 0))
+ newcred->isroot = 1;
newcred->hook = cred->hook;
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libtrivfs/io-restrict-auth.c
hurd-20010329-iohelp/libtrivfs/io-restrict-auth.c
--- hurd-20010329-snapshot/libtrivfs/io-restrict-auth.c Mon Nov 18 18:55:41 1996
+++ hurd-20010329-iohelp/libtrivfs/io-restrict-auth.c Sun Apr 1 08:13:49 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation
+ Copyright (C) 1993,94,95,96,2001 Free Software Foundation
This file is part of the GNU Hurd.
@@ -44,7 +44,7 @@
uid_t *gids, u_int ngids)
{
int i;
- error_t err = 0;
+ error_t err;
struct trivfs_protid *newcred;
struct idvec *uvec, *gvec;
struct iouser *user;
@@ -52,26 +52,51 @@
if (!cred)
return EOPNOTSUPP;
- uvec = make_idvec ();
- gvec = make_idvec ();
-
- user = iohelp_create_iouser (uvec, gvec);
-
if (cred->isroot)
+ /* CRED has root access, and so may use any ids. */
{
- /* CRED has root access, and so may use any ids. */
- idvec_set_ids (uvec, uids, nuids);
- idvec_set_ids (gvec, gids, ngids);
+ err = iohelp_create_complex_iouser (&user, uids, nuids, gids, ngids);
+ if (err)
+ return err;
}
else
{
+ uvec = make_idvec ();
+ if (! uvec)
+ return ENOMEM;
+
+ gvec = make_idvec ();
+ if (! gvec)
+ {
+ idvec_free (uvec);
+ return ENOMEM;
+ }
+
/* Otherwise, use any of the requested ids that CRED already has. */
for (i = 0; i < cred->user->uids->num; i++)
if (listmember (uids, cred->user->uids->ids[i], nuids))
- idvec_add (uvec, cred->user->uids->ids[i]);
+ {
+ err = idvec_add (uvec, cred->user->uids->ids[i]);
+ if (err)
+ goto out;
+ }
+
for (i = 0; i < cred->user->gids->num; i++)
if (listmember (gids, cred->user->gids->ids[i], ngids))
- idvec_add (gvec, cred->user->gids->ids[i]);
+ {
+ err = idvec_add (gvec, cred->user->gids->ids[i]);
+ if (err)
+ goto out;
+ }
+
+ err = iohelp_create_iouser (&user, uvec, gvec);
+ if (err)
+ {
+ out:
+ idvec_free (uvec);
+ idvec_free (gvec);
+ return err;
+ }
}
err = ports_create_port (cred->po->cntl->protid_class,
@@ -89,7 +114,7 @@
newcred->po = cred->po;
newcred->po->refcnt++;
mutex_unlock (&cred->po->cntl->lock);
- if (cred->isroot && idvec_contains (uvec, 0))
+ if (cred->isroot && idvec_contains (user->uids, 0))
newcred->isroot = 1;
newcred->user = user;
newcred->hook = cred->hook;
diff --exclude CVS --exclude configure -Nur
hurd-20010329-snapshot/libtrivfs/protid-dup.c
hurd-20010329-iohelp/libtrivfs/protid-dup.c
--- hurd-20010329-snapshot/libtrivfs/protid-dup.c Mon Nov 18 18:55:54 1996
+++ hurd-20010329-iohelp/libtrivfs/protid-dup.c Sun Apr 1 08:14:37 2001
@@ -1,6 +1,6 @@
/* Duplicate a protid
- Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1993,94,95,96,2001 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -42,7 +42,12 @@
new->isroot = cred->isroot;
- new->user = iohelp_dup_iouser (cred->user);
+ err = iohelp_dup_iouser (&new->user, cred->user);
+ if (err)
+ {
+ ports_port_deref (new);
+ return err;
+ }
new->realnode = cred->realnode;
mach_port_mod_refs (mach_task_self (), new->realnode,
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/term/ChangeLog
hurd-20010329-iohelp/term/ChangeLog
--- hurd-20010329-snapshot/term/ChangeLog Wed Jul 26 08:22:49 2000
+++ hurd-20010329-iohelp/term/ChangeLog Sun Apr 1 09:13:10 2001
@@ -1,3 +1,8 @@
+2001-04-01 Neal H Walfield <[EMAIL PROTECTED]>
+
+ * user.c (S_termctty_open_terminal): Use
+ iohelp_create_empty_iouser.
+
2000-07-26 Mark Kettenis <[EMAIL PROTECTED]>
* Makefile (HURDLIBS): Reorder libs such that the threads lib
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/term/users.c
hurd-20010329-iohelp/term/users.c
--- hurd-20010329-snapshot/term/users.c Fri Mar 17 05:32:21 2000
+++ hurd-20010329-iohelp/term/users.c Sun Apr 1 07:26:55 2001
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,01 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -378,6 +378,7 @@
{
error_t err;
mach_port_t new_realnode;
+ struct iouser *user;
struct trivfs_protid *newcred;
struct port_info *pi = ports_lookup_port (term_bucket, arg, cttyid_class);
@@ -390,9 +391,9 @@
if (!err)
{
- err = trivfs_open (termctl,
- iohelp_create_iouser (make_idvec (), make_idvec ()),
- flags, new_realnode, &newcred);
+ err = iohelp_create_empty_iouser (&user);
+ if (! err)
+ err = trivfs_open (termctl, user flags, new_realnode, &newcred);
if (!err)
{
*result = ports_get_right (newcred);
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/trans/ChangeLog
hurd-20010329-iohelp/trans/ChangeLog
--- hurd-20010329-snapshot/trans/ChangeLog Wed Feb 28 23:48:32 2001
+++ hurd-20010329-iohelp/trans/ChangeLog Sun Apr 1 07:28:26 2001
@@ -1,3 +1,8 @@
+2001-04-01 Neal H Walfield <[EMAIL PROTECTED]>
+
+ * magic.c (trivfs_S_dir_lookup): Use iohelp_dup_iouser
+ as per the new semantics.
+
2001-02-28 Roland McGrath <[EMAIL PROTECTED]>
* streamio.c (trivfs_modify_stat): Fix inverted sense of tests
diff --exclude CVS --exclude configure -Nur hurd-20010329-snapshot/trans/magic.c
hurd-20010329-iohelp/trans/magic.c
--- hurd-20010329-snapshot/trans/magic.c Sun Feb 25 23:16:01 2001
+++ hurd-20010329-iohelp/trans/magic.c Sun Apr 1 07:27:36 2001
@@ -214,7 +214,9 @@
/* Execute the open */
dotdot = (mach_port_t) cred->po->hook;
- user = iohelp_dup_iouser (cred->user);
+ err = iohelp_dup_iouser (&user, cred->user);
+ if (err)
+ return err;
err = magic_open (cred->po->cntl, user, dotdot, flags,
cred->realnode, &newcred);
if (err)
PGP signature