mirror of
https://github.com/samba-team/samba.git
synced 2025-12-12 12:23:50 +03:00
r7912: make private_path() recognise a non-relative filename, so we can have
sam database = sam.ldb and it will know to put it in the private dir, but if you use sam database = ldap://server it knows to use it as-is
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
a7447e25ac
commit
c5bccbc366
@@ -657,13 +657,19 @@ char *lib_path(TALLOC_CTX* mem_ctx, const char *name)
|
||||
* @brief Returns an absolute path to a file in the Samba private directory.
|
||||
*
|
||||
* @param name File to find, relative to PRIVATEDIR.
|
||||
* if name is not relative, then use it as-is
|
||||
*
|
||||
* @retval Pointer to a talloc'ed string containing the full path.
|
||||
**/
|
||||
|
||||
char *private_path(TALLOC_CTX* mem_ctx, const char *name)
|
||||
{
|
||||
char *fname;
|
||||
if (name == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
|
||||
return talloc_strdup(mem_ctx, name);
|
||||
}
|
||||
fname = talloc_asprintf(mem_ctx, "%s/%s", lp_private_dir(), name);
|
||||
return fname;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user