rpc: convert all uid and gid variables to u_int.
After further discussion, instead of pretending to use uid_t and gid_t as upstream Solaris and linux try to, we are better using u_int, which is in fact what the code can handle and best approaches the range of values used by uid and gid. Discussed with: bde Reviewed by: bde
This commit is contained in:
parent
0eb8162623
commit
0d1040e5e1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241181
@ -243,13 +243,13 @@ __END_DECLS
|
|||||||
* System style authentication
|
* System style authentication
|
||||||
* AUTH *authunix_create(machname, uid, gid, len, aup_gids)
|
* AUTH *authunix_create(machname, uid, gid, len, aup_gids)
|
||||||
* char *machname;
|
* char *machname;
|
||||||
* uid_t uid;
|
* u_int uid;
|
||||||
* gid_t gid;
|
* u_int gid;
|
||||||
* int len;
|
* int len;
|
||||||
* gid_t *aup_gids;
|
* u_int *aup_gids;
|
||||||
*/
|
*/
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
extern AUTH *authunix_create(char *, uid_t, gid_t, int, gid_t *);
|
extern AUTH *authunix_create(char *, u_int, u_int, int, u_int *);
|
||||||
extern AUTH *authunix_create_default(void); /* takes no parameters */
|
extern AUTH *authunix_create_default(void); /* takes no parameters */
|
||||||
extern AUTH *authnone_create(void); /* takes no parameters */
|
extern AUTH *authnone_create(void); /* takes no parameters */
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
@ -60,10 +60,10 @@
|
|||||||
struct authunix_parms {
|
struct authunix_parms {
|
||||||
u_long aup_time;
|
u_long aup_time;
|
||||||
char *aup_machname;
|
char *aup_machname;
|
||||||
uid_t aup_uid;
|
u_int aup_uid;
|
||||||
gid_t aup_gid;
|
u_int aup_gid;
|
||||||
u_int aup_len;
|
u_int aup_len;
|
||||||
gid_t *aup_gids;
|
u_int *aup_gids;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define authsys_parms authunix_parms
|
#define authsys_parms authunix_parms
|
||||||
|
@ -94,10 +94,10 @@ struct audata {
|
|||||||
AUTH *
|
AUTH *
|
||||||
authunix_create(machname, uid, gid, len, aup_gids)
|
authunix_create(machname, uid, gid, len, aup_gids)
|
||||||
char *machname;
|
char *machname;
|
||||||
uid_t uid;
|
u_int uid;
|
||||||
gid_t gid;
|
u_int gid;
|
||||||
int len;
|
int len;
|
||||||
gid_t *aup_gids;
|
u_int *aup_gids;
|
||||||
{
|
{
|
||||||
struct authunix_parms aup;
|
struct authunix_parms aup;
|
||||||
char mymem[MAX_AUTH_BYTES];
|
char mymem[MAX_AUTH_BYTES];
|
||||||
@ -207,6 +207,7 @@ authunix_create_default()
|
|||||||
abort();
|
abort();
|
||||||
if (ngids > NGRPS)
|
if (ngids > NGRPS)
|
||||||
ngids = NGRPS;
|
ngids = NGRPS;
|
||||||
|
/* XXX: interface problem; we should translate from uid_t and gid_t */
|
||||||
auth = authunix_create(machname, uid, gid, ngids, gids);
|
auth = authunix_create(machname, uid, gid, ngids, gids);
|
||||||
free(gids);
|
free(gids);
|
||||||
return (auth);
|
return (auth);
|
||||||
|
@ -60,7 +60,7 @@ xdr_authunix_parms(xdrs, p)
|
|||||||
XDR *xdrs;
|
XDR *xdrs;
|
||||||
struct authunix_parms *p;
|
struct authunix_parms *p;
|
||||||
{
|
{
|
||||||
gid_t **paup_gids;
|
u_int **paup_gids;
|
||||||
|
|
||||||
assert(xdrs != NULL);
|
assert(xdrs != NULL);
|
||||||
assert(p != NULL);
|
assert(p != NULL);
|
||||||
@ -72,7 +72,7 @@ xdr_authunix_parms(xdrs, p)
|
|||||||
xdr_u_int(xdrs, &(p->aup_uid)) &&
|
xdr_u_int(xdrs, &(p->aup_uid)) &&
|
||||||
xdr_u_int(xdrs, &(p->aup_gid)) &&
|
xdr_u_int(xdrs, &(p->aup_gid)) &&
|
||||||
xdr_array(xdrs, (char **) paup_gids,
|
xdr_array(xdrs, (char **) paup_gids,
|
||||||
&(p->aup_len), NGRPS, sizeof(gid_t), (xdrproc_t)xdr_int) ) {
|
&(p->aup_len), NGRPS, sizeof(u_int), (xdrproc_t)xdr_u_int) ) {
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
@ -148,7 +148,7 @@ default authentication used by
|
|||||||
.Ft "AUTH *"
|
.Ft "AUTH *"
|
||||||
.Xc
|
.Xc
|
||||||
.It Xo
|
.It Xo
|
||||||
.Fn authunix_create "char *host" "uid_t uid" "gid_t gid" "int len" "gid_t *aup_gids"
|
.Fn authunix_create "char *host" "u_int uid" "u_int gid" "int len" "u_int *aup_gids"
|
||||||
.Xc
|
.Xc
|
||||||
.Pp
|
.Pp
|
||||||
Create and return an
|
Create and return an
|
||||||
|
@ -68,7 +68,7 @@ _svcauth_unix(rqst, msg)
|
|||||||
struct area {
|
struct area {
|
||||||
struct authunix_parms area_aup;
|
struct authunix_parms area_aup;
|
||||||
char area_machname[MAX_MACHINE_NAME+1];
|
char area_machname[MAX_MACHINE_NAME+1];
|
||||||
gid_t area_gids[NGRPS];
|
u_int area_gids[NGRPS];
|
||||||
} *area;
|
} *area;
|
||||||
u_int auth_len;
|
u_int auth_len;
|
||||||
size_t str_len, gid_len;
|
size_t str_len, gid_len;
|
||||||
|
@ -234,17 +234,17 @@ __END_DECLS
|
|||||||
* System style authentication
|
* System style authentication
|
||||||
* AUTH *authunix_create(machname, uid, gid, len, aup_gids)
|
* AUTH *authunix_create(machname, uid, gid, len, aup_gids)
|
||||||
* char *machname;
|
* char *machname;
|
||||||
* uid_t uid;
|
* u_int uid;
|
||||||
* gid_t gid;
|
* u_int gid;
|
||||||
* int len;
|
* int len;
|
||||||
* gid_t *aup_gids;
|
* u_int *aup_gids;
|
||||||
*/
|
*/
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
struct ucred;
|
struct ucred;
|
||||||
extern AUTH *authunix_create(struct ucred *);
|
extern AUTH *authunix_create(struct ucred *);
|
||||||
#else
|
#else
|
||||||
extern AUTH *authunix_create(char *, uid_t, gid_t, int, gid_t *);
|
extern AUTH *authunix_create(char *, u_int, u_int, int, u_int *);
|
||||||
extern AUTH *authunix_create_default(void); /* takes no parameters */
|
extern AUTH *authunix_create_default(void); /* takes no parameters */
|
||||||
#endif
|
#endif
|
||||||
extern AUTH *authnone_create(void); /* takes no parameters */
|
extern AUTH *authnone_create(void); /* takes no parameters */
|
||||||
|
Loading…
Reference in New Issue
Block a user