|
@ -210,7 +210,7 @@ int mgmt_auth (mgmt_req_t *req, char *auth) { |
|
|
/*
|
|
|
/*
|
|
|
* Handle the common and shred parts of the mgmt_req_t initialisation |
|
|
* Handle the common and shred parts of the mgmt_req_t initialisation |
|
|
*/ |
|
|
*/ |
|
|
void mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { |
|
|
bool mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { |
|
|
char *typechar; |
|
|
char *typechar; |
|
|
char *options; |
|
|
char *options; |
|
|
char *flagstr; |
|
|
char *flagstr; |
|
@ -226,7 +226,7 @@ void mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { |
|
|
if(!typechar) { |
|
|
if(!typechar) { |
|
|
/* should not happen */ |
|
|
/* should not happen */ |
|
|
mgmt_error(req, buf, "notype"); |
|
|
mgmt_error(req, buf, "notype"); |
|
|
return; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
if(*typechar == 'r') { |
|
|
if(*typechar == 'r') { |
|
|
req->type=N2N_MGMT_READ; |
|
|
req->type=N2N_MGMT_READ; |
|
@ -236,20 +236,20 @@ void mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { |
|
|
req->type=N2N_MGMT_SUB; |
|
|
req->type=N2N_MGMT_SUB; |
|
|
} else { |
|
|
} else { |
|
|
mgmt_error(req, buf, "badtype"); |
|
|
mgmt_error(req, buf, "badtype"); |
|
|
return; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* Extract the tag to use in all reply packets */ |
|
|
/* Extract the tag to use in all reply packets */ |
|
|
options = strtok(NULL, " \r\n"); |
|
|
options = strtok(NULL, " \r\n"); |
|
|
if(!options) { |
|
|
if(!options) { |
|
|
mgmt_error(req, buf, "nooptions"); |
|
|
mgmt_error(req, buf, "nooptions"); |
|
|
return; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
req->argv0 = strtok(NULL, " \r\n"); |
|
|
req->argv0 = strtok(NULL, " \r\n"); |
|
|
if(!req->argv0) { |
|
|
if(!req->argv0) { |
|
|
mgmt_error(req, buf, "nocmd"); |
|
|
mgmt_error(req, buf, "nocmd"); |
|
|
return; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*
|
|
|
/*
|
|
@ -281,6 +281,8 @@ void mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { |
|
|
|
|
|
|
|
|
if(!mgmt_auth(req, auth)) { |
|
|
if(!mgmt_auth(req, auth)) { |
|
|
mgmt_error(req, buf, "badauth"); |
|
|
mgmt_error(req, buf, "badauth"); |
|
|
return; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
} |
|
|
} |
|
|