[Midnightbsd-cvs] src [8175] trunk: rpc: convert all uid and gid variables to u_int.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Sep 16 22:45:52 EDT 2016
Revision: 8175
http://svnweb.midnightbsd.org/src/?rev=8175
Author: laffer1
Date: 2016-09-16 22:45:52 -0400 (Fri, 16 Sep 2016)
Log Message:
-----------
rpc: convert all uid and gid variables to u_int.
Modified Paths:
--------------
trunk/include/rpc/auth.h
trunk/include/rpc/auth_unix.h
trunk/lib/libc/rpc/auth_unix.c
trunk/lib/libc/rpc/authunix_prot.c
trunk/lib/libc/rpc/rpc_soc.3
trunk/lib/libc/rpc/svc_auth_unix.c
trunk/sys/rpc/auth.h
Modified: trunk/include/rpc/auth.h
===================================================================
--- trunk/include/rpc/auth.h 2016-09-17 02:42:23 UTC (rev 8174)
+++ trunk/include/rpc/auth.h 2016-09-17 02:45:52 UTC (rev 8175)
@@ -243,14 +243,13 @@
* System style authentication
* AUTH *authunix_create(machname, uid, gid, len, aup_gids)
* char *machname;
- * int uid;
- * int gid;
+ * u_int uid;
+ * u_int gid;
* int len;
- * int *aup_gids;
+ * u_int *aup_gids;
*/
__BEGIN_DECLS
-extern AUTH *authunix_create(char *, int, int, int,
- int *);
+extern AUTH *authunix_create(char *, u_int, u_int, int, u_int *);
extern AUTH *authunix_create_default(void); /* takes no parameters */
extern AUTH *authnone_create(void); /* takes no parameters */
__END_DECLS
Modified: trunk/include/rpc/auth_unix.h
===================================================================
--- trunk/include/rpc/auth_unix.h 2016-09-17 02:42:23 UTC (rev 8174)
+++ trunk/include/rpc/auth_unix.h 2016-09-17 02:45:52 UTC (rev 8175)
@@ -60,10 +60,10 @@
struct authunix_parms {
u_long aup_time;
char *aup_machname;
- int aup_uid;
- int aup_gid;
+ u_int aup_uid;
+ u_int aup_gid;
u_int aup_len;
- int *aup_gids;
+ u_int *aup_gids;
};
#define authsys_parms authunix_parms
Modified: trunk/lib/libc/rpc/auth_unix.c
===================================================================
--- trunk/lib/libc/rpc/auth_unix.c 2016-09-17 02:42:23 UTC (rev 8174)
+++ trunk/lib/libc/rpc/auth_unix.c 2016-09-17 02:45:52 UTC (rev 8175)
@@ -94,10 +94,10 @@
AUTH *
authunix_create(machname, uid, gid, len, aup_gids)
char *machname;
- int uid;
- int gid;
+ u_int uid;
+ u_int gid;
int len;
- int *aup_gids;
+ u_int *aup_gids;
{
struct authunix_parms aup;
char mymem[MAX_AUTH_BYTES];
@@ -189,9 +189,9 @@
int ngids;
long ngids_max;
char machname[MAXHOSTNAMELEN + 1];
- uid_t uid;
- gid_t gid;
- gid_t *gids;
+ u_int uid;
+ u_int gid;
+ u_int *gids;
ngids_max = sysconf(_SC_NGROUPS_MAX) + 1;
gids = malloc(sizeof(gid_t) * ngids_max);
@@ -207,9 +207,8 @@
abort();
if (ngids > NGRPS)
ngids = NGRPS;
- /* XXX: interface problem; those should all have been unsigned */
- auth = authunix_create(machname, (int)uid, (int)gid, ngids,
- (int *)gids);
+ /* XXX: interface problem; we should translate from uid_t and gid_t */
+ auth = authunix_create(machname, uid, gid, ngids, gids);
free(gids);
return (auth);
}
Modified: trunk/lib/libc/rpc/authunix_prot.c
===================================================================
--- trunk/lib/libc/rpc/authunix_prot.c 2016-09-17 02:42:23 UTC (rev 8174)
+++ trunk/lib/libc/rpc/authunix_prot.c 2016-09-17 02:45:52 UTC (rev 8175)
@@ -60,7 +60,7 @@
XDR *xdrs;
struct authunix_parms *p;
{
- int **paup_gids;
+ u_int **paup_gids;
assert(xdrs != NULL);
assert(p != NULL);
@@ -67,12 +67,12 @@
paup_gids = &p->aup_gids;
- if (xdr_u_long(xdrs, &(p->aup_time))
- && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME)
- && xdr_int(xdrs, &(p->aup_uid))
- && xdr_int(xdrs, &(p->aup_gid))
- && xdr_array(xdrs, (char **) paup_gids,
- &(p->aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) {
+ if (xdr_u_long(xdrs, &(p->aup_time)) &&
+ xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME) &&
+ xdr_u_int(xdrs, &(p->aup_uid)) &&
+ xdr_u_int(xdrs, &(p->aup_gid)) &&
+ xdr_array(xdrs, (char **) paup_gids,
+ &(p->aup_len), NGRPS, sizeof(u_int), (xdrproc_t)xdr_u_int) ) {
return (TRUE);
}
return (FALSE);
Modified: trunk/lib/libc/rpc/rpc_soc.3
===================================================================
--- trunk/lib/libc/rpc/rpc_soc.3 2016-09-17 02:42:23 UTC (rev 8174)
+++ trunk/lib/libc/rpc/rpc_soc.3 2016-09-17 02:45:52 UTC (rev 8175)
@@ -148,7 +148,7 @@
.Ft "AUTH *"
.Xc
.It Xo
-.Fn authunix_create "char *host" "int uid" "int gid" "int len" "int *aup_gids"
+.Fn authunix_create "char *host" "u_int uid" "u_int gid" "int len" "u_int *aup_gids"
.Xc
.Pp
Create and return an
Modified: trunk/lib/libc/rpc/svc_auth_unix.c
===================================================================
--- trunk/lib/libc/rpc/svc_auth_unix.c 2016-09-17 02:42:23 UTC (rev 8174)
+++ trunk/lib/libc/rpc/svc_auth_unix.c 2016-09-17 02:45:52 UTC (rev 8175)
@@ -68,7 +68,7 @@
struct area {
struct authunix_parms area_aup;
char area_machname[MAX_MACHINE_NAME+1];
- int area_gids[NGRPS];
+ u_int area_gids[NGRPS];
} *area;
u_int auth_len;
size_t str_len, gid_len;
Modified: trunk/sys/rpc/auth.h
===================================================================
--- trunk/sys/rpc/auth.h 2016-09-17 02:42:23 UTC (rev 8174)
+++ trunk/sys/rpc/auth.h 2016-09-17 02:45:52 UTC (rev 8175)
@@ -234,10 +234,10 @@
* System style authentication
* AUTH *authunix_create(machname, uid, gid, len, aup_gids)
* char *machname;
- * int uid;
- * int gid;
+ * u_int uid;
+ * u_int gid;
* int len;
- * int *aup_gids;
+ * u_int *aup_gids;
*/
__BEGIN_DECLS
#ifdef _KERNEL
@@ -244,8 +244,7 @@
struct ucred;
extern AUTH *authunix_create(struct ucred *);
#else
-extern AUTH *authunix_create(char *, int, int, int,
- int *);
+extern AUTH *authunix_create(char *, u_int, u_int, int, u_int *);
extern AUTH *authunix_create_default(void); /* takes no parameters */
#endif
extern AUTH *authnone_create(void); /* takes no parameters */
More information about the Midnightbsd-cvs
mailing list