From 4e1de143b38e2fb64dd3c7d4030e939b53c8db0f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 22 Feb 2001 06:22:20 +0000 Subject: - workaround filer lsa lookup bug for unknown sids - add \ at start of name if not needed (another filer workaround) (This used to be commit 48ab6297a1b462e03f70a4d90d50b21982d0d90d) --- source3/utils/smbcacls.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'source3') diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 0aa2c4399d..bef16d349c 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -118,7 +118,8 @@ static void SidToString(fstring str, DOM_SID *sid) if (!open_policy_hnd() || cli_lsa_lookup_sids(&lsa_cli, &pol, 1, sid, &names, &types, - &num_names) != NT_STATUS_NOPROBLEMO) { + &num_names) != NT_STATUS_NOPROBLEMO || + !names || !names[0]) { return; } @@ -834,7 +835,7 @@ You can string acls together with spaces, commas or newlines\n\ int main(int argc,char *argv[]) { char *share; - char *filename; + pstring filename; extern char *optarg; extern int optind; extern FILE *dbf; @@ -860,7 +861,7 @@ You can string acls together with spaces, commas or newlines\n\ setup_logging(argv[0],True); share = argv[1]; - filename = argv[2]; + pstrcpy(filename, argv[2]); all_string_sub(share,"/","\\",0); argc -= 2; @@ -962,14 +963,12 @@ You can string acls together with spaces, commas or newlines\n\ if (!cli) exit(EXIT_FAILED); } - { - char *s; - - s = filename; - while(*s) { - if (*s == '/') *s = '\\'; - s++; - } + all_string_sub(filename, "/", "\\", 0); + if (filename[0] != '\\') { + pstring s; + s[0] = '\\'; + safe_strcpy(&s[1], filename, sizeof(pstring)-1); + pstrcpy(filename, s); } /* Perform requested action */ -- cgit