ncpcalls: use descriptive names for NCP wrapper functions
Rename the low-level NCP wrapper functions in ncpcall.c and net.h to include both the NCP function/subfunction number and the operation they perform. This keeps the numeric protocol reference visible for comparison with SDK documentation and MARS-NWE logs, while making call sites easier to understand. Update all callers to use the new names. No behavior change.
This commit is contained in:
22
login.c
22
login.c
@@ -631,8 +631,8 @@ static int do_change_object_passwd(char *name,
|
||||
{
|
||||
uint8 key[8];
|
||||
|
||||
if (!ncp_17_17(key)) {
|
||||
uint32 objid = ncp_17_35(name, objtyp);
|
||||
if (!ncp17_17_get_encryption_key(key)) {
|
||||
uint32 objid = ncp17_35_get_bindery_object_id(name, objtyp);
|
||||
if (objid) {
|
||||
uint8 oldpwd[16]; /* old passwd as stored by server */
|
||||
uint8 newpwd[16]; /* new passwd as stored by server */
|
||||
@@ -663,7 +663,7 @@ static int do_change_object_passwd(char *name,
|
||||
if (newlen > 63) newlen = 63;
|
||||
passwdx = (uint8)(((newlen ^ oldpwd[0] ^ oldpwd[1]) & 0x7f) | 0x40);
|
||||
|
||||
if (!ncp_17_4b(cryptkey, name, objtyp, passwdx, newpwd)) {
|
||||
if (!ncp17_4b_keyed_change_password(cryptkey, name, objtyp, passwdx, newpwd)) {
|
||||
;;
|
||||
return(0);
|
||||
}
|
||||
@@ -674,7 +674,7 @@ static int do_change_object_passwd(char *name,
|
||||
* Fallback for old servers/requesters where Get Encryption Key is not
|
||||
* available. Keep the original unencrypted behavior as fallback only.
|
||||
*/
|
||||
if (!ncp_17_40(name, objtyp, oldpassword, newpassword)) {
|
||||
if (!ncp17_40_change_password_unencrypted(name, objtyp, oldpassword, newpassword)) {
|
||||
;;
|
||||
return(0);
|
||||
}
|
||||
@@ -685,8 +685,8 @@ static int do_change_object_passwd(char *name,
|
||||
static int do_object_login(char *name, uint16 objtyp, char *password, int option)
|
||||
{
|
||||
uint8 key[8];
|
||||
if (!(option & 1) && !ncp_17_17(key)) {
|
||||
uint32 objid = ncp_17_35(name, objtyp);
|
||||
if (!(option & 1) && !ncp17_17_get_encryption_key(key)) {
|
||||
uint32 objid = ncp17_35_get_bindery_object_id(name, objtyp);
|
||||
if (objid) {
|
||||
uint8 buff[128];
|
||||
uint8 encrypted[8];
|
||||
@@ -694,13 +694,13 @@ static int do_object_login(char *name, uint16 objtyp, char *password, int option
|
||||
U32_TO_BE32(objid, tmpid);
|
||||
shuffle(tmpid, password, strlen(password), buff);
|
||||
nw_encrypt(key, buff, encrypted);
|
||||
if (!ncp_17_18(encrypted, name, objtyp)) {
|
||||
if (!ncp17_18_keyed_object_login(encrypted, name, objtyp)) {
|
||||
;;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
} else { /* now we use old unencrypted algorithmus */
|
||||
if (!ncp_17_14(name, objtyp, password)) {
|
||||
if (!ncp17_14_login_object_unencrypted(name, objtyp, password)) {
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
@@ -926,7 +926,7 @@ int func_passwd(int argc, char *argv[], int mode)
|
||||
uint8 upasswd[130];
|
||||
uint32 my_obj_id;
|
||||
|
||||
if (ncp_14_46(&my_obj_id) < 0 || my_obj_id == MAX_U32 || !my_obj_id) {
|
||||
if (ncp17_46_get_bindery_access_level(&my_obj_id) < 0 || my_obj_id == MAX_U32 || !my_obj_id) {
|
||||
fprintf(stderr, "Cannot get actual user id\n");
|
||||
result = -1;
|
||||
}
|
||||
@@ -935,14 +935,14 @@ int func_passwd(int argc, char *argv[], int mode)
|
||||
uint32 obj_id;
|
||||
strmaxcpy(uname, argv[1], sizeof(uname) -1);
|
||||
upstr(uname);
|
||||
obj_id = ncp_17_35(uname, 1);
|
||||
obj_id = ncp17_35_get_bindery_object_id(uname, 1);
|
||||
if (!obj_id) {
|
||||
fprintf(stderr, "Unkwown user: %s\n", uname);
|
||||
return(-1);
|
||||
}
|
||||
} else if (!result) {
|
||||
uint16 obj_typ;
|
||||
if (ncp_17_36(my_obj_id, uname, &obj_typ) || obj_typ != 1) {
|
||||
if (ncp17_36_get_bindery_object_name(my_obj_id, uname, &obj_typ) || obj_typ != 1) {
|
||||
fprintf(stderr, "Cannot get actual username\n");
|
||||
result=-1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user