diff --git a/src/nwconn.c b/src/nwconn.c index 8d87c0a..bb12638 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -777,12 +777,26 @@ static int handle_ncp_serv(void) uint8 pathlen; uint8 path[2]; } *input = (struct INPUT *) (ncprequest); - int result = nw_add_trustee( + uint32 trustee_id = GET_BE32(input->trustee_id); + int trustee_rights = (int)input->trustee_right_mask; + int copylen = input->pathlen; + uint8 pathbuf[256]; + int result; + + if (copylen > 255) copylen = 255; + memcpy(pathbuf, input->path, copylen); + pathbuf[copylen] = '\0'; + + result = nw_add_trustee( input->dir_handle, input->path, input->pathlen, - GET_BE32(input->trustee_id), - (int)input->trustee_right_mask, + trustee_id, + trustee_rights, 0); + XDPRINTF((5,0, + "NCP22/0D AddTrustee: dh=%d pathlen=%d path=`%s` obj=0x%08lx rights=0x%02x rc=%d", + input->dir_handle, input->pathlen, pathbuf, + (unsigned long)trustee_id, trustee_rights, result)); if (result) completition = (uint8) -result; } break; @@ -797,11 +811,24 @@ static int handle_ncp_serv(void) uint8 pathlen; uint8 path[2]; } *input = (struct INPUT *) (ncprequest); - int result = nw_del_trustee( + uint32 trustee_id = GET_BE32(input->trustee_id); + int copylen = input->pathlen; + uint8 pathbuf[256]; + int result; + + if (copylen > 255) copylen = 255; + memcpy(pathbuf, input->path, copylen); + pathbuf[copylen] = '\0'; + + result = nw_del_trustee( input->dir_handle, input->path, input->pathlen, - GET_BE32(input->trustee_id), + trustee_id, 0); /* normal */ + XDPRINTF((5,0, + "NCP22/0E DelTrustee: dh=%d pathlen=%d path=`%s` obj=0x%08lx rc=%d", + input->dir_handle, input->pathlen, pathbuf, + (unsigned long)trustee_id, result)); if (result) completition = (uint8) -result; } break; @@ -1146,12 +1173,26 @@ static int handle_ncp_serv(void) uint8 pathlen; uint8 path[2]; } *input = (struct INPUT *) (ncprequest); - int result = nw_add_trustee( + uint32 trustee_id = GET_BE32(input->trustee_id); + int trustee_rights = GET_16(input->trustee_rights); + int copylen = input->pathlen; + uint8 pathbuf[256]; + int result; + + if (copylen > 255) copylen = 255; + memcpy(pathbuf, input->path, copylen); + pathbuf[copylen] = '\0'; + + result = nw_add_trustee( input->dir_handle, input->path, input->pathlen, - GET_BE32(input->trustee_id), - GET_16(input->trustee_rights), + trustee_id, + trustee_rights, 1); /* extended */ + XDPRINTF((5,0, + "NCP22/27 SetTrustee: dh=%d pathlen=%d path=`%s` obj=0x%08lx rights=0x%04x rc=%d", + input->dir_handle, input->pathlen, pathbuf, + (unsigned long)trustee_id, trustee_rights, result)); if (result) completition = (uint8) -result; } break; @@ -1243,11 +1284,24 @@ static int handle_ncp_serv(void) uint8 pathlen; uint8 path[2]; } *input = (struct INPUT *) (ncprequest); - int result = nw_del_trustee( + uint32 trustee_id = GET_BE32(input->trustee_id); + int copylen = input->pathlen; + uint8 pathbuf[256]; + int result; + + if (copylen > 255) copylen = 255; + memcpy(pathbuf, input->path, copylen); + pathbuf[copylen] = '\0'; + + result = nw_del_trustee( input->dir_handle, input->path, input->pathlen, - GET_BE32(input->trustee_id), + trustee_id, 1); /* extended */ + XDPRINTF((5,0, + "NCP22/2B DelTrustee: dh=%d pathlen=%d path=`%s` obj=0x%08lx rc=%d", + input->dir_handle, input->pathlen, pathbuf, + (unsigned long)trustee_id, result)); if (result) completition = (uint8) -result; } break;