mirror of
https://github.com/samba-team/samba.git
synced 2025-09-17 05:44:20 +03:00
cmdline:burn: localise some variables
As this function increases in complexity, it helps to keep things close. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15674 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
This commit is contained in:
committed by
Douglas Bagnall
parent
d3d8dffc02
commit
f5233ddf97
@@ -138,24 +138,22 @@ void samba_cmdline_set_machine_account_fn(
|
|||||||
bool samba_cmdline_burn(int argc, char *argv[])
|
bool samba_cmdline_burn(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
bool burnt = false;
|
bool burnt = false;
|
||||||
bool found = false;
|
|
||||||
bool is_user = false;
|
|
||||||
char *p = NULL;
|
|
||||||
int i;
|
int i;
|
||||||
size_t ulen = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
|
bool found = false;
|
||||||
|
bool is_user = false;
|
||||||
|
size_t ulen = 0;
|
||||||
|
char *p = NULL;
|
||||||
|
|
||||||
p = argv[i];
|
p = argv[i];
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return burnt;
|
return burnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
found = false;
|
|
||||||
is_user = false;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Take care that this list must be in longest-match
|
* Take care that this list must be in longest-match
|
||||||
* first order
|
* first order (e.g. --password2 before --password).
|
||||||
*/
|
*/
|
||||||
if (strncmp(p, "-U", 2) == 0) {
|
if (strncmp(p, "-U", 2) == 0) {
|
||||||
ulen = 2;
|
ulen = 2;
|
||||||
@@ -177,8 +175,6 @@ bool samba_cmdline_burn(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
char *q = NULL;
|
|
||||||
|
|
||||||
if (strlen(p) == ulen) {
|
if (strlen(p) == ulen) {
|
||||||
/*
|
/*
|
||||||
* The option string has no '=', so
|
* The option string has no '=', so
|
||||||
@@ -209,7 +205,7 @@ bool samba_cmdline_burn(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_user) {
|
if (is_user) {
|
||||||
q = strchr_m(p, '%');
|
char *q = strchr_m(p, '%');
|
||||||
if (q == NULL) {
|
if (q == NULL) {
|
||||||
/* -U without '%' has no secret */
|
/* -U without '%' has no secret */
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user