Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/rpc Add set_rpc_maxgrouplist



details:   https://anonhg.NetBSD.org/src/rev/a224a13e70ec
branches:  trunk
changeset: 940097:a224a13e70ec
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 03 18:31:29 2020 +0000

description:
Add set_rpc_maxgrouplist

diffstat:

 lib/libc/rpc/Makefile.inc    |   3 ++-
 lib/libc/rpc/auth_unix.c     |  20 ++++++++++++++++++--
 lib/libc/rpc/rpc_clnt_auth.3 |  17 ++++++++++++++---
 3 files changed, 34 insertions(+), 6 deletions(-)

diffs (112 lines):

diff -r 2572981a4584 -r a224a13e70ec lib/libc/rpc/Makefile.inc
--- a/lib/libc/rpc/Makefile.inc Sat Oct 03 18:30:39 2020 +0000
+++ b/lib/libc/rpc/Makefile.inc Sat Oct 03 18:31:29 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.26 2019/10/13 07:28:10 mrg Exp $
+#      $NetBSD: Makefile.inc,v 1.27 2020/10/03 18:31:29 christos Exp $
 
 # librpc sources
 .PATH: ${.CURDIR}/rpc
@@ -38,6 +38,7 @@
                rpc_clnt_auth.3 authnone_create.3 \
                rpc_clnt_auth.3 authsys_create.3 \
                rpc_clnt_auth.3 authsys_create_default.3 \
+               rpc_clnt_auth.3 set_rpc_maxgrouplist.3 \
                rpc_clnt_calls.3 clnt_call.3 \
                rpc_clnt_calls.3 clnt_perrno.3 \
                rpc_clnt_calls.3 clnt_perror.3 \
diff -r 2572981a4584 -r a224a13e70ec lib/libc/rpc/auth_unix.c
--- a/lib/libc/rpc/auth_unix.c  Sat Oct 03 18:30:39 2020 +0000
+++ b/lib/libc/rpc/auth_unix.c  Sat Oct 03 18:31:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auth_unix.c,v 1.26 2014/10/18 08:33:23 snj Exp $       */
+/*     $NetBSD: auth_unix.c,v 1.27 2020/10/03 18:31:29 christos Exp $  */
 
 /*
  * Copyright (c) 2010, Oracle America, Inc.
@@ -37,7 +37,7 @@
 static char *sccsid = "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";
 static char *sccsid = "@(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC";
 #else
-__RCSID("$NetBSD: auth_unix.c,v 1.26 2014/10/18 08:33:23 snj Exp $");
+__RCSID("$NetBSD: auth_unix.c,v 1.27 2020/10/03 18:31:29 christos Exp $");
 #endif
 #endif
 
@@ -183,6 +183,20 @@
 }
 
 /*
+ * Some servers will refuse mounts if the group list is larger
+ * than it expects (like 8). This allows the application to set
+ * the maximum size of the group list that will be sent.
+ */
+static int maxgrplist = NGROUPS;
+
+void
+set_rpc_maxgrouplist(int num)
+{
+       if (num < NGROUPS)
+               maxgrplist = num;
+}
+
+/*
  * Returns an auth handle with parameters determined by doing lots of
  * syscalls.
  */
@@ -202,6 +216,8 @@
        gid = getegid();
        if ((len = getgroups(NGRPS, gids)) < 0)
                abort();
+       if (len > maxgrplist)
+               len = maxgrplist;
        /* XXX: interface problem; those should all have been unsigned */
        return (authunix_create(machname, (int)uid, (int)gid, len,
            (int *)gids));
diff -r 2572981a4584 -r a224a13e70ec lib/libc/rpc/rpc_clnt_auth.3
--- a/lib/libc/rpc/rpc_clnt_auth.3      Sat Oct 03 18:30:39 2020 +0000
+++ b/lib/libc/rpc/rpc_clnt_auth.3      Sat Oct 03 18:31:29 2020 +0000
@@ -2,15 +2,16 @@
 .\" Copyright 1989 AT&T
 .\" @(#)rpc_clnt_auth 1.4 89/07/20 SMI;
 .\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
-.\"    $NetBSD: rpc_clnt_auth.3,v 1.6 2003/04/16 13:34:43 wiz Exp $
-.Dd May 7, 1993
+.\"    $NetBSD: rpc_clnt_auth.3,v 1.7 2020/10/03 18:31:29 christos Exp $
+.Dd October 3, 2020
 .Dt RPC_CLNT_AUTH 3
 .Os
 .Sh NAME
 .Nm auth_destroy ,
 .Nm authnone_create ,
 .Nm authsys_create ,
-.Nm authsys_create_default
+.Nm authsys_create_default ,
+.Nm set_rpc_maxgrouplist
 .Nd library routines for client side remote procedure call authentication
 .Sh LIBRARY
 .Lb libc
@@ -24,6 +25,8 @@
 .Fn authsys_create "const char *host" "const uid_t uid" "const gid_t gid" "const int len" "const gid_t *aup_gids"
 .Ft "AUTH *"
 .Fn authsys_create_default "void"
+.Ft "void"
+.Fn set_rpc_maxgrouplist "int num"
 .Sh DESCRIPTION
 These routines are part of the
 RPC library that allows C language programs to make procedure
@@ -90,6 +93,14 @@
 Call
 .Fn authsys_create
 with the appropriate parameters.
+.Pp
+.It Fn set_rpc_maxgrouplist
+Allow the application to set the maximum size of the group list
+that will be used in
+.Fn authunix_create_default to
+.Fa num .
+Some servers will refuse mounts if the group list is larger than it expects
+(like 8).
 .El
 .Sh SEE ALSO
 .Xr rpc 3 ,



Home | Main Index | Thread Index | Old Index