/*
- * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
handle = NULL;
return 2;
}
- if (handle->Security == 0) { /* share-level security, unuseable */
+ if (handle->Security == 0) { /* share-level security, unusable */
debug("SMB Server uses share-level security .. we need user security.\n");
SMB_Discon(handle, 0);
handle = NULL;
const char *
make_challenge(char *domain, char *domain_controller)
{
- /* trying to circumvent some strange problem wih pointers in SMBLib */
+ /* trying to circumvent some strange problem with pointers in SMBLib */
/* Ugly as hell, but the lib is going to be dropped... */
strncpy(my_domain, domain, sizeof(my_domain)-1);
my_domain[sizeof(my_domain)-1] = '\0';
size_t len = sizeof(chal) - sizeof(chal.payload) + le16toh(chal.target.maxlen);
// for lack of a good NTLM token size limit, allow up to what the helper input can be
// validations later will expect to be limited to that size.
- static uint8_t b64buf[HELPER_INPUT_BUFFER-10]; /* 10 for other line fields, delimiters and terminator */
+ static char b64buf[HELPER_INPUT_BUFFER-10]; /* 10 for other line fields, delimiters and terminator */
if (base64_encode_len(len) < sizeof(b64buf)-1) {
debug("base64 encoding of the token challenge will exceed %" PRIuSIZE " bytes", sizeof(b64buf));
return NULL;
size_t blen = base64_encode_update(&ctx, b64buf, len, reinterpret_cast<const uint8_t *>(&chal));
blen += base64_encode_final(&ctx, b64buf+blen);
b64buf[blen] = '\0';
- return reinterpret_cast<const char*>(b64buf);
+ return b64buf;
}
/* returns NULL on failure, or a pointer to
}
}
if (had_error)
- exit(1);
+ exit(EXIT_FAILURE);
/* Okay, now begin filling controllers up */
/* we can avoid memcpy-ing, and just reuse argv[] */
for (j = optind; j < argc; ++j) {
if (numcontrollers == 0) {
fprintf(stderr, "You must specify at least one domain-controller!\n");
usage();
- exit(1);
+ exit(EXIT_FAILURE);
}
last_dc->next = controllers; /* close the queue, now it's circular */
}
if (fgets(buf, NTLM_BLOB_BUFFER_SIZE, stdin) == NULL) {
fprintf(stderr, "fgets() failed! dying..... errno=%d (%s)\n", errno,
strerror(errno));
- exit(1); /* BIIG buffer */
+ exit(EXIT_FAILURE); /* BIIG buffer */
}
debug("managing request\n");
ch2 = (char*)memchr(buf, '\n', NTLM_BLOB_BUFFER_SIZE); /* safer against overrun than strchr */
base64_decode_init(&ctx);
size_t dstLen = 0;
int decodedLen = 0;
- if (!base64_decode_update(&ctx, &dstLen, reinterpret_cast<uint8_t*>(decoded), strlen(buf)-3, reinterpret_cast<const uint8_t*>(buf+3)) ||
+ if (!base64_decode_update(&ctx, &dstLen, reinterpret_cast<uint8_t*>(decoded), strlen(buf)-3, buf+3) ||
!base64_decode_final(&ctx)) {
SEND("NA Packet format error, couldn't base64-decode");
return;
}
/* there was an error. We have two errno's to look at.
* libntlmssp's erno is insufficient, we'll have to look at
- * the actual SMB library error codes, to acually figure
+ * the actual SMB library error codes, to actually figure
* out what's happening. The thing has braindamaged interfacess..*/
smblib_err = SMB_Get_Last_Error();
smb_errorclass = SMBlib_Error_Class(SMB_Get_Last_SMB_Err());
manage_request();
}
/* notreached */
- return 0;
+ return EXIT_SUCCESS;
}