+/*
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
/* Find passwords ... */
/* We do it in a brute force way ... Cycle through all the possible passwords
sending a logon to see if all it works ... We have to wait for any timeout
#include <sys/types.h>
#include <unistd.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
-#include "smblib.h"
+#include "smblib/smblib.h"
int verbose = FALSE;
int lotc = FALSE;
if (pwinit == FALSE) {
pwinit = TRUE;
- bzero(pw, pwlen + 1);
+ memset(pw, 0, pwlen + 1);
pwpos = 0;
}
if (((unsigned)password[i] <= ' ') || ((unsigned)password[i] > 127)) {
pwd_str[j] = '\\';
- sprintf(temp, "%03i", (int)password[i]);
+ snprintf(temp, sizeof(temp)-1, "%03i", (int)password[i]);
strcpy(&pwd_str[j + 1], temp);
j = j + 3; /* Space for \ accounted for below */
}
- sprintf(service_name, "\\\\%s\\%s", server, service); /* Could blow up */
+ sprintf(service_name, sizeof(service_name)-1, "\\\\%s\\%s", server, service); /* Could blow up */
/* Now loop through all password possibilities ... */
- bzero(password, sizeof(password));
+ memset(password, 0, sizeof(password));
while (next_password(password, pwlen) == TRUE) {
fprintf(stderr, "Passwords exhausted.");
}
+