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

s3:net: Load ODJ blob from file only if "loadfile" parameter is present

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13577

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit b2399b6994c89404f245e1a97ba1c1cf13d7fc86)
This commit is contained in:
Samuel Cabrero 2023-08-30 20:25:17 +02:00 committed by Jule Anger
parent ca6ba98409
commit 1f066b595f

View File

@ -257,7 +257,6 @@ int net_offlinejoin_requestodj(struct net_context *c,
uint8_t *provision_bin_data = NULL;
size_t provision_bin_data_size = 0;
uint32_t options = NETSETUP_PROVISION_ONLINE_CALLER;
const char *loadfile = NULL;
const char *windows_path = NULL;
int i;
@ -270,10 +269,23 @@ int net_offlinejoin_requestodj(struct net_context *c,
for (i = 0; i < argc; i++) {
if (strnequal(argv[i], "loadfile", strlen("loadfile"))) {
const char *loadfile = NULL;
loadfile = get_string_param(argv[i]);
if (loadfile == NULL) {
return -1;
}
provision_bin_data =
(uint8_t *)file_load(loadfile,
&provision_bin_data_size,
0,
c);
if (provision_bin_data == NULL) {
d_printf("Failed to read loadfile: %s\n",
loadfile);
return -1;
}
}
#if 0
if (strnequal(argv[i], "localos", strlen("localos"))) {
@ -282,10 +294,8 @@ int net_offlinejoin_requestodj(struct net_context *c,
#endif
}
provision_bin_data =
(uint8_t *)file_load(loadfile, &provision_bin_data_size, 0, c);
if (provision_bin_data == NULL) {
d_printf("Failed to read loadfile: %s\n", loadfile);
if (provision_bin_data == NULL || provision_bin_data_size == 0) {
d_printf("Please provide provision data\n");
return -1;
}
if (provision_bin_data_size > UINT32_MAX) {