Select Git revision
zs3-keyctl-order
zs3-keyctl-order 1.49 KiB
Index: nfs-utils-1.3.4/utils/nfsidmap/nfsidmap.c
===================================================================
--- nfs-utils-1.3.4.orig/utils/nfsidmap/nfsidmap.c
+++ nfs-utils-1.3.4/utils/nfsidmap/nfsidmap.c
@@ -17,6 +17,7 @@
#include "conffile.h"
int verbose = 0;
+int timeout = 600;
char *usage = "Usage: %s [-vh] [-c || [-u|-g|-r key] || -d || -l || [-t timeout] key desc]";
#define MAX_ID_LEN 11
@@ -209,6 +210,10 @@ static int id_lookup(char *name_at_domai
return EXIT_FAILURE;
}
+ /* Set timeout to 10 (600 seconds) minutes */
+ if (rc == EXIT_SUCCESS)
+ keyctl_set_timeout(key, timeout);
+
rc = EXIT_SUCCESS;
if (keyctl_instantiate(key, id, strlen(id) + 1, 0)) {
switch (errno) {
@@ -266,6 +271,10 @@ static int name_lookup(char *id, key_ser
return EXIT_FAILURE;
}
+ /* Set timeout to 10 (600 seconds) minutes */
+ if (rc == EXIT_SUCCESS)
+ keyctl_set_timeout(key, timeout);
+
rc = EXIT_SUCCESS;
if (keyctl_instantiate(key, &name, strlen(name), 0)) {
rc = EXIT_FAILURE;
@@ -356,7 +365,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, display = 0, list = 0;
@@ -470,10 +478,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 == EXIT_SUCCESS)
- keyctl_set_timeout(key, timeout);
-
free(arg);
return rc;
}