1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

s3: smbd: Remove the commented out resolve_wildcards().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2021-12-01 16:31:36 -08:00 committed by Ralph Boehme
parent ff722c0fdf
commit fe92aaa962

View File

@ -7062,135 +7062,6 @@ void reply_rmdir(struct smb_request *req)
return;
}
#if 0
/*******************************************************************
Resolve wildcards in a filename rename.
********************************************************************/
static bool resolve_wildcards(TALLOC_CTX *ctx,
const char *name1,
const char *name2,
char **pp_newname)
{
char *name2_copy = NULL;
char *root1 = NULL;
char *root2 = NULL;
char *ext1 = NULL;
char *ext2 = NULL;
char *p,*p2, *pname1, *pname2;
name2_copy = talloc_strdup(ctx, name2);
if (!name2_copy) {
return False;
}
pname1 = strrchr_m(name1,'/');
pname2 = strrchr_m(name2_copy,'/');
if (!pname1 || !pname2) {
return False;
}
/* Truncate the copy of name2 at the last '/' */
*pname2 = '\0';
/* Now go past the '/' */
pname1++;
pname2++;
root1 = talloc_strdup(ctx, pname1);
root2 = talloc_strdup(ctx, pname2);
if (!root1 || !root2) {
return False;
}
p = strrchr_m(root1,'.');
if (p) {
*p = 0;
ext1 = talloc_strdup(ctx, p+1);
} else {
ext1 = talloc_strdup(ctx, "");
}
p = strrchr_m(root2,'.');
if (p) {
*p = 0;
ext2 = talloc_strdup(ctx, p+1);
} else {
ext2 = talloc_strdup(ctx, "");
}
if (!ext1 || !ext2) {
return False;
}
p = root1;
p2 = root2;
while (*p2) {
if (*p2 == '?') {
/* Hmmm. Should this be mb-aware ? */
*p2 = *p;
p2++;
} else if (*p2 == '*') {
*p2 = '\0';
root2 = talloc_asprintf(ctx, "%s%s",
root2,
p);
if (!root2) {
return False;
}
break;
} else {
p2++;
}
if (*p) {
p++;
}
}
p = ext1;
p2 = ext2;
while (*p2) {
if (*p2 == '?') {
/* Hmmm. Should this be mb-aware ? */
*p2 = *p;
p2++;
} else if (*p2 == '*') {
*p2 = '\0';
ext2 = talloc_asprintf(ctx, "%s%s",
ext2,
p);
if (!ext2) {
return False;
}
break;
} else {
p2++;
}
if (*p) {
p++;
}
}
if (*ext2) {
*pp_newname = talloc_asprintf(ctx, "%s/%s.%s",
name2_copy,
root2,
ext2);
} else {
*pp_newname = talloc_asprintf(ctx, "%s/%s",
name2_copy,
root2);
}
if (!*pp_newname) {
return False;
}
return True;
}
#endif
/****************************************************************************
Ensure open files have their names updated. Updated to notify other smbd's
asynchronously.