From 114ed05d8d163eed1622750dc024c69a513bc9d8 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 24 Mar 2010 22:07:29 -0400 Subject: [PATCH] Windows: output pt error messages as strings Build and link in ptserver/pterror.c so that aklog can output pt error messages as strings. LICENSE MIT Change-Id: I93d966e0e62bb693612c6310781aadbfa6c09988 Reviewed-on: http://gerrit.openafs.org/1658 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/aklog/NTMakefile | 7 ++++++- src/WINNT/aklog/aklog.c | 11 +++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/WINNT/aklog/NTMakefile b/src/WINNT/aklog/NTMakefile index ed93308e83..034eb920d8 100644 --- a/src/WINNT/aklog/NTMakefile +++ b/src/WINNT/aklog/NTMakefile @@ -22,6 +22,11 @@ AKLOGOBJS = \ $(OUT)\aklog.obj \ $(OUT)\linked_list.obj +PTERROBJS=$(OUT)\pterror.obj + +$(PTERROBJS): $(AFSROOT)\src\ptserver\pterror.c + $(C2OBJ) /Fo$@ $** + ASETKEY = $(DESTDIR)\root.server\usr\afs\bin\asetkey.exe ASETKEYOBJS = \ @@ -58,7 +63,7 @@ $(ASETKEYOBJS): $$(@B).c ############################################################################ -$(AKLOG) : $(AKLOGOBJS) $(EXELIBS) $(OUT)\aklog.res +$(AKLOG) : $(AKLOGOBJS) $(PTERROBJS) $(EXELIBS) $(OUT)\aklog.res $(EXECONLINK) $(EXELIBS) $(OTHERLIBS) $(LINKOPTS) $(_VC_MANIFEST_EMBED_EXE) $(EXEPREP) diff --git a/src/WINNT/aklog/aklog.c b/src/WINNT/aklog/aklog.c index ded73c2fd2..04907af91c 100644 --- a/src/WINNT/aklog/aklog.c +++ b/src/WINNT/aklog/aklog.c @@ -301,7 +301,7 @@ void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell, if (dflag) { if (*status) - printf("Error %d\n", *status); + printf("pr_SNameToId Error %s\n", afs_error_message(*status)); else printf("Id %d\n", viceId); } @@ -357,7 +357,7 @@ void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell, */ if ((*status = pr_Initialize(1L, confname, aserver->cell))) { - printf("Error %d\n", *status); + printf("pr_Initialize Error %s\n", afs_error_message(*status)); return; } @@ -371,8 +371,8 @@ void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell, if (*status) { printf("%s: unable to create remote PTS " - "user %s in cell %s (status: %d).\n", progname, - username, cell_to_use, *status); + "user %s in cell %s (status: %s).\n", progname, + username, cell_to_use, afs_error_message(*status)); } else { printf("created cross-cell entry for %s (Id %d) at %s\n", username, viceId, cell_to_use); @@ -1552,6 +1552,9 @@ int main(int argc, char *argv[]) } } + if (!noprdb) + initialize_PT_error_table(); + if (usev5) { validate_krb5_availability(); if (krb5_init_context(&context))