summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
264ad7d)
Since this binary is being called by the kernel, errors
need to be logged to the syslog for help in debugging problems.
Signed-off-by: Steve Dickson <steved@redhat.com>
sbin_PROGRAMS = nfsidmap
nfsidmap_SOURCES = nfsidmap.c
sbin_PROGRAMS = nfsidmap
nfsidmap_SOURCES = nfsidmap.c
-nfsidmap_LDADD = -lnfsidmap -lkeyutils
+nfsidmap_LDADD = -lnfsidmap -lkeyutils ../../support/nfs/libnfs.a
MAINTAINERCLEANFILES = Makefile.in
MAINTAINERCLEANFILES = Makefile.in
#include <nfsidmap.h>
#include <syslog.h>
#include <nfsidmap.h>
#include <syslog.h>
/* gcc nfsidmap.c -o nfsidmap -l nfsidmap -l keyutils */
/* gcc nfsidmap.c -o nfsidmap -l nfsidmap -l keyutils */
rc = nfs4_group_owner_to_gid(name_at_domain, &gid);
sprintf(id, "%u", gid);
}
rc = nfs4_group_owner_to_gid(name_at_domain, &gid);
sprintf(id, "%u", gid);
}
+ if (rc < 0)
+ xlog_err("id_lookup: %s: failed: %m",
+ (type == USER ? "nfs4_owner_to_uid" : "nfs4_group_owner_to_gid"));
rc = keyctl_instantiate(key, id, strlen(id) + 1, 0);
rc = keyctl_instantiate(key, id, strlen(id) + 1, 0);
+ if (rc < 0)
+ xlog_err("id_lookup: keyctl_instantiate failed: %m");
+ }
rc = nfs4_get_default_domain(NULL, domain, NFS4_MAX_DOMAIN_LEN);
if (rc != 0) {
rc = -1;
rc = nfs4_get_default_domain(NULL, domain, NFS4_MAX_DOMAIN_LEN);
if (rc != 0) {
rc = -1;
+ xlog_err("name_lookup: nfs4_get_default_domain failed: %m");
gid = atoi(id);
rc = nfs4_gid_to_name(gid, domain, name, IDMAP_NAMESZ);
}
gid = atoi(id);
rc = nfs4_gid_to_name(gid, domain, name, IDMAP_NAMESZ);
}
+ if (rc < 0)
+ xlog_err("name_lookup: %s: failed: %m",
+ (type == USER ? "nfs4_uid_to_name" : "nfs4_gid_to_name"));
rc = keyctl_instantiate(key, &name, strlen(name), 0);
rc = keyctl_instantiate(key, &name, strlen(name), 0);
+ if (rc < 0)
+ xlog_err("name_lookup: keyctl_instantiate failed: %m");
+ }
int rc = 1;
int timeout = 600;
key_serial_t key;
int rc = 1;
int timeout = 600;
key_serial_t key;
+ char *progname;
+
+ /* Set the basename */
+ if ((progname = strrchr(argv[0], '/')) != NULL)
+ progname++;
+ else
+ progname = argv[0];
+ xlog_open(progname);
+ xlog_syslog(1);
+ xlog_stderr(0);
+
+ if (argc < 3) {
+ xlog_err("Bad arg count. Check /etc/request-key.conf");
arg = malloc(sizeof(char) * strlen(argv[2]) + 1);
strcpy(arg, argv[2]);
arg = malloc(sizeof(char) * strlen(argv[2]) + 1);
strcpy(arg, argv[2]);