diff options
author | Günther Deschner <gd@samba.org> | 2007-08-14 15:17:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:29:43 -0500 |
commit | 36a85969f92fe976a3e698d590b5a102e0593fc2 (patch) | |
tree | a362ee6d8ff2914e9b28dc30392e0a4d33a44cb5 /source3/libgpo/gpo_util.c | |
parent | 73b3ae9c55c5c1b3d20c69ce3571d066556881ed (diff) | |
download | samba-36a85969f92fe976a3e698d590b5a102e0593fc2.tar.gz samba-36a85969f92fe976a3e698d590b5a102e0593fc2.tar.bz2 samba-36a85969f92fe976a3e698d590b5a102e0593fc2.zip |
r24416: Some more minor edits for libgpo, mostly reformatting and moving of functions.
Guenther
(This used to be commit 3e240672b431b7132dfb2bdd46198ab758eadd0b)
Diffstat (limited to 'source3/libgpo/gpo_util.c')
-rw-r--r-- | source3/libgpo/gpo_util.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source3/libgpo/gpo_util.c b/source3/libgpo/gpo_util.c index c6e1b71885..16a578509b 100644 --- a/source3/libgpo/gpo_util.c +++ b/source3/libgpo/gpo_util.c @@ -662,4 +662,45 @@ NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads, return result; } + +/**************************************************************** +****************************************************************/ + +NTSTATUS gp_find_file(TALLOC_CTX *mem_ctx, + uint32_t flags, + const char *filename, + const char *suffix, + const char **filename_out) +{ + const char *tmp = NULL; + SMB_STRUCT_STAT sbuf; + const char *path = NULL; + + if (flags & GPO_LIST_FLAG_MACHINE) { + path = "Machine"; + } else { + path = "User"; + } + + tmp = talloc_asprintf(mem_ctx, "%s/%s/%s", filename, + path, suffix); + NT_STATUS_HAVE_NO_MEMORY(tmp); + + if (sys_stat(tmp, &sbuf) == 0) { + *filename_out = tmp; + return NT_STATUS_OK; + } + + tmp = talloc_asprintf(mem_ctx, "%s/%s/%s", filename, + strupper_static(path), suffix); + NT_STATUS_HAVE_NO_MEMORY(tmp); + + if (sys_stat(tmp, &sbuf) == 0) { + *filename_out = tmp; + return NT_STATUS_OK; + } + + return NT_STATUS_NO_SUCH_FILE; +} + #endif /* HAVE_LDAP */ |