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>
(cherry picked from commit
f5233ddf974f9649d8a12b151b6843412eab489c)
bool samba_cmdline_burn(int argc, char *argv[])
{
bool burnt = false;
- bool found = false;
- bool is_user = false;
- char *p = NULL;
int i;
- size_t ulen = 0;
for (i = 0; i < argc; i++) {
+ bool found = false;
+ bool is_user = false;
+ size_t ulen = 0;
+ char *p = NULL;
+
p = argv[i];
if (p == NULL) {
return burnt;
}
- found = false;
- is_user = false;
-
/*
* 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) {
ulen = 2;
}
if (found) {
- char *q = NULL;
-
if (strlen(p) == ulen) {
/*
* The option string has no '=', so
}
if (is_user) {
- q = strchr_m(p, '%');
+ char *q = strchr_m(p, '%');
if (q == NULL) {
/* -U without '%' has no secret */
continue;