Author: vlendec Date: 2005-10-25 09:42:22 +0000 (Tue, 25 Oct 2005) New Revision: 11286
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11286 Log: Fix a potential segfault Modified: branches/SAMBA_3_0/source/rpcclient/cmd_lsarpc.c trunk/source/rpcclient/cmd_lsarpc.c Changeset: Modified: branches/SAMBA_3_0/source/rpcclient/cmd_lsarpc.c =================================================================== --- branches/SAMBA_3_0/source/rpcclient/cmd_lsarpc.c 2005-10-25 09:30:48 UTC (rev 11285) +++ branches/SAMBA_3_0/source/rpcclient/cmd_lsarpc.c 2005-10-25 09:42:22 UTC (rev 11286) @@ -68,9 +68,8 @@ { POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - DOM_SID *dom_sid; + DOM_SID *dom_sid = NULL; struct uuid *dom_guid; - fstring sid_str; char *domain_name = NULL; char *dns_name = NULL; char *forest_name = NULL; @@ -114,12 +113,16 @@ if (!NT_STATUS_IS_OK(result)) goto done; - sid_to_string(sid_str, dom_sid); - - if (domain_name) - printf("domain %s has sid %s\n", domain_name, sid_str); - else + if (domain_name) { + if (dom_sid == NULL) { + printf("got no sid for domain %s\n", domain_name); + } else { + printf("domain %s has sid %s\n", domain_name, + sid_string_static(dom_sid)); + } + } else { printf("could not query info for level %d\n", info_class); + } if (dns_name) printf("domain dns name is %s\n", dns_name); Modified: trunk/source/rpcclient/cmd_lsarpc.c =================================================================== --- trunk/source/rpcclient/cmd_lsarpc.c 2005-10-25 09:30:48 UTC (rev 11285) +++ trunk/source/rpcclient/cmd_lsarpc.c 2005-10-25 09:42:22 UTC (rev 11286) @@ -68,9 +68,8 @@ { POLICY_HND pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - DOM_SID *dom_sid; + DOM_SID *dom_sid = NULL; struct uuid *dom_guid; - fstring sid_str; char *domain_name = NULL; char *dns_name = NULL; char *forest_name = NULL; @@ -114,12 +113,16 @@ if (!NT_STATUS_IS_OK(result)) goto done; - sid_to_string(sid_str, dom_sid); - - if (domain_name) - printf("domain %s has sid %s\n", domain_name, sid_str); - else + if (domain_name) { + if (dom_sid == NULL) { + printf("got no sid for domain %s\n", domain_name); + } else { + printf("domain %s has sid %s\n", domain_name, + sid_string_static(dom_sid)); + } + } else { printf("could not query info for level %d\n", info_class); + } if (dns_name) printf("domain dns name is %s\n", dns_name);
