testprogs: use ConvertSidToStringSid in order to print sids in spoolss test.
authorGünther Deschner <gd@samba.org>
Wed, 10 Feb 2010 23:04:53 +0000 (00:04 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 11 Feb 2010 12:24:41 +0000 (13:24 +0100)
Guenther

testprogs/win32/spoolss/printlib.c

index ff185170fc523501ea9e719de0604cc21ecdd9cc..30f4208c2f06124cf4e31ff15e4f6adcd42d5197 100644 (file)
@@ -22,6 +22,7 @@
 #include <windows.h>
 #include <stdio.h>
 #include <assert.h>
+#include <sddl.h>
 
 void print_devmode(DEVMODE *pDevModeIn)
 {
@@ -125,24 +126,27 @@ void print_acl(const char* str, ACL *acl)
        return;
 }
 
-void print_sid(const char* str, SID *sid)
+void PrintLastError();
+
+void print_sid(LPSTR str, PSID sid)
 {
-       DWORD   i = 0;
+       LPSTR sid_string;
 
        printf("%s\n", str);
-       printf("0x%x\n", sid);
-       if (sid == NULL)
+
+       if (sid == NULL) {
+               printf("(null sid)\n");
+               return;
+       }
+
+       if (!ConvertSidToStringSid(sid, &sid_string)) {
+               PrintLastError();
                return;
-       printf("\t\tRevision\t\t0x%x\n", sid->Revision);
-       printf("\t\tSubAuthorityCount\t0x%x\n", sid->SubAuthorityCount);
-       printf("\t\tSubAuthority\n\t");
-       while (i < sid->SubAuthorityCount) {
-               printf("\t0x%x", sid->SubAuthority[i]);
-               if (i%4 == 3)
-                       printf("\n\t");
-               i++;
        }
 
+       printf("%s\n", sid_string);
+       LocalFree(sid_string);
+
        return;
 }