#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <string.h>
#include <errno.h>
#include <pwd.h>
ret = write(fd, ¶m, sizeof(param));
if (ret != sizeof(param)) {
- logmsg(LL_ERR, "lustre ioctl err: %d\n", strerror(errno));
+ logmsg(LL_ERR, "lustre ioctl err: %s\n", strerror(errno));
close(fd);
return -EACCES;
}
logmsg(LL_TRACE, "do_nego_rpc: to parse reply\n");
if (param.status) {
- logmsg(LL_ERR, "status: %d (%s)\n",
- param.status, strerror((int)param.status));
+ logmsg(LL_ERR, "status: %ld (%s)\n",
+ param.status, strerror((int)param.status));
/* kernel return -ETIMEDOUT means the rpc timedout, we should
* notify the caller to reinitiate the gss negotiation, by
memcpy(gr->gr_token.value, p, gr->gr_token.length);
p += (((gr->gr_token.length + 3) & ~3) / 4);
- logmsg(LL_DEBUG, "do_nego_rpc: receive handle len %d, token len %d, " \
+ logmsg(LL_DEBUG, "do_nego_rpc: receive handle len %zu, token len %zu, "
"res %d\n", gr->gr_ctx.length, gr->gr_token.length, res);
return 0;
}
OM_uint32 min_stat;
int rc = -1;
- logmsg(LL_TRACE, "child start on behalf of key %08x: "
- "cred %p, uid %u, svc %u, nid %llx, uids: %u:%u/%u:%u\n",
- keyid, cred, cred->lc_uid, cred->lc_tgt_svc, cred->lc_tgt_nid,
- kup->kup_uid, kup->kup_gid, kup->kup_fsuid, kup->kup_fsgid);
+ logmsg(LL_TRACE, "child start on behalf of key %08x: "
+ "cred %p, uid %u, svc %u, nid %"PRIx64", uids: %u:%u/%u:%u\n",
+ keyid, cred, cred->lc_uid, cred->lc_tgt_svc, cred->lc_tgt_nid,
+ kup->kup_uid, kup->kup_gid, kup->kup_fsuid, kup->kup_fsgid);
if (lgss_get_service_str(&g_service, kup->kup_svc, kup->kup_nid)) {
logmsg(LL_ERR, "key %08x: failed to construct service "
uparam->kup_selfnid = strtoll(data[8], NULL, 0);
logmsg(LL_DEBUG, "parse call out info: secid %d, mech %s, ugid %u:%u, "
- "is_root %d, is_mdt %d, is_ost %d, svc %d, nid 0x%llx, tgt %s, "
- "self nid 0x%llx\n",
+ "is_root %d, is_mdt %d, is_ost %d, svc %d, nid 0x%"PRIx64", "
+ "tgt %s, self nid 0x%"PRIx64"\n",
uparam->kup_secid, uparam->kup_mech,
uparam->kup_uid, uparam->kup_gid,
uparam->kup_is_root, uparam->kup_is_mdt, uparam->kup_is_ost,
if (self_nid != 0) {
if (lnet_nid2hostname(self_nid, namebuf, max_namelen)) {
logmsg(loglevel,
- "can't resolve hostname from nid %llx\n",
+ "can't resolve hostname from nid %"PRIx64"\n",
self_nid);
return -1;
}
if (code != 0)
break;
- logmsg(LL_DEBUG, "cred: server realm %.*s, type %d, name %.*s; "
- "time (%d-%d, renew till %d), valid %d\n",
- krb5_princ_realm(ctx, cred.server)->length,
- krb5_princ_realm(ctx, cred.server)->data,
- krb5_princ_type(ctx, cred.server),
- krb5_princ_name(ctx, cred.server)->length,
- krb5_princ_name(ctx, cred.server)->data,
- cred.times.starttime, cred.times.endtime,
- cred.times.renew_till, cred.times.endtime - now);
+ logmsg(LL_DEBUG, "cred: server realm %.*s, type %d, name %.*s; "
+ "time (%lld-%lld, renew till %lld), valid %lld\n",
+ krb5_princ_realm(ctx, cred.server)->length,
+ krb5_princ_realm(ctx, cred.server)->data,
+ krb5_princ_type(ctx, cred.server),
+ krb5_princ_name(ctx, cred.server)->length,
+ krb5_princ_name(ctx, cred.server)->data,
+ (long long)cred.times.starttime,
+ (long long)cred.times.endtime,
+ (long long)cred.times.renew_till,
+ (long long)(cred.times.endtime - now));
/* FIXME
* we found the princ type is always 0 (KRB5_NT_UNKNOWN), why???
}
if (lnet_nid2hostname(tgt_nid, namebuf, max_namelen)) {
- logmsg(LL_ERR,"can't resolve hostname from nid %llx\n",tgt_nid);
+ logmsg(LL_ERR, "cannot resolve hostname from nid %"PRIx64"\n",
+ tgt_nid);
return -1;
}
void lgss_set_loglevel(loglevel_t level);
-void __logmsg(loglevel_t level, const char *func, const char *format, ...);
+void __logmsg(loglevel_t level, const char *func, const char *format, ...)
+ __attribute__((format(printf, 3, 4)));
+
void __logmsg_gss(loglevel_t level, const char *func, const gss_OID mech,
- uint32_t major, uint32_t minor, const char *format, ...);
+ uint32_t major, uint32_t minor, const char *format, ...)
+ __attribute__((format(printf, 6, 7)));
#define logmsg(loglevel, format, args...) \
do { \
#define printerr(priority, format, args...) \
logmsg(priority, format, ##args)
-#define pgsserr(msg, maj_stat, min_stat, mech) \
- logmsg_gss(LL_ERR, mech, maj_stat, min_stat, "")
+#define pgsserr(msg, maj_stat, min_stat, mech) \
+ logmsg_gss(LL_ERR, mech, maj_stat, min_stat, msg)
/****************************************
* GSS MECH, OIDs *