Select Git revision
20-DU-static-translation.patch
zs3-keyctl-order.older 1.51 KiB
Index: nfs-utils-1.2.8/utils/nfsidmap/nfsidmap.c
===================================================================
--- nfs-utils-1.2.8.orig/utils/nfsidmap/nfsidmap.c
+++ nfs-utils-1.2.8/utils/nfsidmap/nfsidmap.c
@@ -33,6 +33,8 @@ char *usage="Usage: %s [-v] [-c || [-u|-
static int keyring_clear(char *keyring);
+int timeout = 600;
+
#define UIDKEYS 0x1
#define GIDKEYS 0x2
@@ -58,6 +60,9 @@ int id_lookup(char *name_at_domain, key_
(type == USER ? "nfs4_owner_to_uid" : "nfs4_group_owner_to_gid"));
if (rc == 0) {
+ /* Set timeout to 10 (600 seconds) minutes */
+ keyctl_set_timeout(key, timeout);
+
rc = keyctl_instantiate(key, id, strlen(id) + 1, 0);
if (rc < 0) {
switch(rc) {
@@ -112,6 +117,9 @@ int name_lookup(char *id, key_serial_t k
(type == USER ? "nfs4_uid_to_name" : "nfs4_gid_to_name"));
if (rc == 0) {
+ /* Set timeout to 10 (600 seconds) minutes */
+ keyctl_set_timeout(key, timeout);
+
rc = keyctl_instantiate(key, &name, strlen(name), 0);
if (rc < 0)
xlog_err("name_lookup: keyctl_instantiate failed: %m");
@@ -230,7 +238,6 @@ int main(int argc, char **argv)
char *value;
char *type;
int rc = 1, opt;
- int timeout = 600;
key_serial_t key;
char *progname, *keystr = NULL;
int clearing = 0, keymask = 0;
@@ -323,10 +330,6 @@ int main(int argc, char **argv)
else if (strcmp(type, "group") == 0)
rc = name_lookup(value, key, GROUP);
- /* Set timeout to 10 (600 seconds) minutes */
- if (rc == 0)
- keyctl_set_timeout(key, timeout);
-
free(arg);
return rc;
}