log: normalize AFP fork and temp-handle messages
This commit is contained in:
64
src/nwconn.c
64
src/nwconn.c
@@ -816,7 +816,7 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len,
|
||||
uint32 fork_len = 0;
|
||||
|
||||
if (afp_len < 9) {
|
||||
XDPRINTF((2,0, "AFP Open File Fork rejected: short request len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/8 REJECT reason=short_request len=%d fn=0x23 sub=0x08 result=0x7e",
|
||||
afp_len));
|
||||
return(-0x7e); /* NCP Boundary Check Failed */
|
||||
}
|
||||
@@ -827,20 +827,20 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len,
|
||||
access_mode = afp_req[7];
|
||||
path_len = (int)afp_req[8];
|
||||
if (path_len < 0 || afp_len < 9 + path_len) {
|
||||
XDPRINTF((2,0, "AFP Open File Fork rejected: boundary check len=%d path_len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/8 REJECT reason=boundary_check len=%d path_len=%d fn=0x23 sub=0x08 result=0x7e",
|
||||
afp_len, path_len));
|
||||
return(-0x7e);
|
||||
}
|
||||
|
||||
if (!nwatalk_backend_available()) {
|
||||
XDPRINTF((3,0, "AFP Open File Fork rejected: AFP xattr metadata backend unavailable"));
|
||||
XDPRINTF((3,0, "WARN AFP 35/8 REJECT reason=xattr_backend_unavailable fn=0x23 sub=0x08 result=0xbf"));
|
||||
return(-0xbf); /* invalid namespace */
|
||||
}
|
||||
|
||||
if (fork_indicator != 0) {
|
||||
XDPRINTF((2,0, "AFP Open File Fork rejected: resource fork unsupported vol=%d entry=0x%08x fork=%d access=0x%02x",
|
||||
XDPRINTF((2,0, "WARN AFP 35/8 REJECT reason=resource_fork_unsupported vol=%d entry=%u fork=%d access=0x%02x fn=0x23 sub=0x08 entry_hex=0x%08x result=0x9c",
|
||||
(int)volume_number, request_entry_id, (int)fork_indicator,
|
||||
(int)access_mode));
|
||||
(int)access_mode, request_entry_id));
|
||||
return(-0x9c); /* Invalid Path until AppleDouble/resource forks exist */
|
||||
}
|
||||
|
||||
@@ -855,9 +855,9 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len,
|
||||
unixname, sizeof(unixname),
|
||||
&path_volume, &used);
|
||||
if (entry_result) {
|
||||
XDPRINTF((2,0, "AFP Open File Fork entry-id lookup failed: vol=%d entry=0x%08x fork=%d access=0x%02x result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN MAP 35/8 FAIL reason=entry_id_lookup vol=%d entry=%u fork=%d access=0x%02x result=0x%x fn=0x23 sub=0x08 entry_hex=0x%08x",
|
||||
(int)volume_number, request_entry_id, (int)fork_indicator,
|
||||
(int)access_mode, -entry_result));
|
||||
(int)access_mode, -entry_result, request_entry_id));
|
||||
return(entry_result);
|
||||
}
|
||||
|
||||
@@ -869,9 +869,9 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len,
|
||||
0, (int)(access_mode & 0x0f), 0,
|
||||
(int)(ncprequest->task));
|
||||
if (fhandle < 0) {
|
||||
XDPRINTF((2,0, "AFP Open File Fork entry-id open failed: request_vol=%d resolved_vol=%d entry=0x%08x fork=%d access=0x%02x path='%s' result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN FILE 35/8 FAIL reason=open request_vol=%d resolved_vol=%d entry=%u fork=%d access=0x%02x path='%s' result=0x%x fn=0x23 sub=0x08 entry_hex=0x%08x",
|
||||
(int)volume_number, path_volume, request_entry_id,
|
||||
(int)fork_indicator, (int)access_mode, entry_path, -fhandle));
|
||||
(int)fork_indicator, (int)access_mode, entry_path, -fhandle, request_entry_id));
|
||||
return(fhandle);
|
||||
}
|
||||
|
||||
@@ -881,20 +881,20 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len,
|
||||
U32_TO_32(fhandle, response + 2);
|
||||
U32_TO_BE32(fork_len, response + 6);
|
||||
|
||||
XDPRINTF((3,0, "AFP Open File Fork: vol=%d request_vol=%d entry=0x%08x fork=%d access=0x%02x path='%s' handle=%d fork_len=%u entry-id",
|
||||
XDPRINTF((3,0, "INFO AFP 35/8 DONE vol=%d request_vol=%d entry=%u fork=%d access=0x%02x path='%s' handle=%d fork_len=%u mode='entry-id' fn=0x23 sub=0x08 entry_hex=0x%08x fork_len_hex=0x%08x",
|
||||
path_volume, (int)volume_number, request_entry_id,
|
||||
(int)fork_indicator, (int)access_mode, entry_path,
|
||||
fhandle, fork_len));
|
||||
fhandle, fork_len, request_entry_id, fork_len));
|
||||
return(10);
|
||||
}
|
||||
|
||||
path_volume = afp_resolve_path_volume(afp_req + 9, path_len,
|
||||
unixname, sizeof(unixname));
|
||||
if (path_volume < 0) {
|
||||
XDPRINTF((2,0, "AFP Open File Fork path resolve failed: request_vol=%d entry=0x%08x fork=%d access=0x%02x path='%s' result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN MAP 35/8 FAIL reason=path_resolve request_vol=%d entry=%u fork=%d access=0x%02x path='%s' result=0x%x fn=0x23 sub=0x08 entry_hex=0x%08x",
|
||||
(int)volume_number, request_entry_id, (int)fork_indicator,
|
||||
(int)access_mode, visable_data(afp_req + 9, path_len),
|
||||
-path_volume));
|
||||
-path_volume, request_entry_id));
|
||||
return(path_volume);
|
||||
}
|
||||
|
||||
@@ -906,10 +906,10 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len,
|
||||
0, (int)(access_mode & 0x0f), 0,
|
||||
(int)(ncprequest->task));
|
||||
if (fhandle < 0) {
|
||||
XDPRINTF((2,0, "AFP Open File Fork path open failed: request_vol=%d resolved_vol=%d entry=0x%08x fork=%d access=0x%02x path='%s' result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN FILE 35/8 FAIL reason=open request_vol=%d resolved_vol=%d entry=%u fork=%d access=0x%02x path='%s' result=0x%x fn=0x23 sub=0x08 entry_hex=0x%08x",
|
||||
(int)volume_number, path_volume, request_entry_id, (int)fork_indicator,
|
||||
(int)access_mode, visable_data(afp_req + 9, path_len),
|
||||
-fhandle));
|
||||
-fhandle, request_entry_id));
|
||||
return(fhandle);
|
||||
}
|
||||
|
||||
@@ -919,10 +919,10 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len,
|
||||
U32_TO_32(fhandle, response + 2);
|
||||
U32_TO_BE32(fork_len, response + 6);
|
||||
|
||||
XDPRINTF((3,0, "AFP Open File Fork: vol=%d request_vol=%d entry=0x%08x fork=%d access=0x%02x path='%s' handle=%d fork_len=%u",
|
||||
XDPRINTF((3,0, "INFO AFP 35/8 DONE vol=%d request_vol=%d entry=%u fork=%d access=0x%02x path='%s' handle=%d fork_len=%u mode='path' fn=0x23 sub=0x08 entry_hex=0x%08x fork_len_hex=0x%08x",
|
||||
path_volume, (int)volume_number, request_entry_id, (int)fork_indicator,
|
||||
(int)access_mode, visable_data(afp_req + 9, path_len),
|
||||
fhandle, fork_len));
|
||||
fhandle, fork_len, request_entry_id, fork_len));
|
||||
return(10);
|
||||
}
|
||||
|
||||
@@ -946,7 +946,7 @@ static int afp_alloc_temporary_dir_handle(uint8 *afp_req, int afp_len,
|
||||
int dirhandle;
|
||||
|
||||
if (afp_len < 7) {
|
||||
XDPRINTF((2,0, "AFP Alloc Temporary Dir Handle rejected: short request len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/11 REJECT reason=short_request len=%d fn=0x23 sub=0x0b result=0x7e",
|
||||
afp_len));
|
||||
return(-0x7e); /* NCP Boundary Check Failed */
|
||||
}
|
||||
@@ -955,13 +955,13 @@ static int afp_alloc_temporary_dir_handle(uint8 *afp_req, int afp_len,
|
||||
request_entry_id = GET_BE32(afp_req + 2);
|
||||
path_len = (int)afp_req[6];
|
||||
if (path_len < 0 || afp_len < 7 + path_len) {
|
||||
XDPRINTF((2,0, "AFP Alloc Temporary Dir Handle rejected: boundary check len=%d path_len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/11 REJECT reason=boundary_check len=%d path_len=%d fn=0x23 sub=0x0b result=0x7e",
|
||||
afp_len, path_len));
|
||||
return(-0x7e);
|
||||
}
|
||||
|
||||
if (!nwatalk_backend_available()) {
|
||||
XDPRINTF((3,0, "AFP Alloc Temporary Dir Handle rejected: AFP xattr metadata backend unavailable"));
|
||||
XDPRINTF((3,0, "WARN AFP 35/11 REJECT reason=xattr_backend_unavailable fn=0x23 sub=0x0b result=0xbf"));
|
||||
return(-0xbf); /* invalid namespace */
|
||||
}
|
||||
|
||||
@@ -976,50 +976,50 @@ static int afp_alloc_temporary_dir_handle(uint8 *afp_req, int afp_len,
|
||||
unixname, sizeof(unixname),
|
||||
&path_volume, &entry_len);
|
||||
if (entry_result) {
|
||||
XDPRINTF((2,0, "AFP Alloc Temporary Dir Handle entry-id lookup failed: vol=%d entry=0x%08x result=-0x%x",
|
||||
(int)volume_number, request_entry_id, -entry_result));
|
||||
XDPRINTF((2,0, "WARN MAP 35/11 FAIL reason=entry_id_lookup vol=%d entry=%u result=0x%x fn=0x23 sub=0x0b entry_hex=0x%08x",
|
||||
(int)volume_number, request_entry_id, -entry_result, request_entry_id));
|
||||
return(entry_result);
|
||||
}
|
||||
dirhandle = nw_alloc_dir_handle(0, (uint8 *)entry_path, entry_len, 0, 1,
|
||||
(int)(ncprequest->task), &eff_rights);
|
||||
if (dirhandle < 0) {
|
||||
XDPRINTF((2,0, "AFP Alloc Temporary Dir Handle entry-id allocation failed: request_vol=%d resolved_vol=%d entry=0x%08x path='%s' result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN MAP 35/11 FAIL reason=dir_handle_alloc request_vol=%d resolved_vol=%d entry=%u path='%s' result=0x%x fn=0x23 sub=0x0b entry_hex=0x%08x",
|
||||
(int)volume_number, path_volume, request_entry_id,
|
||||
entry_path, -dirhandle));
|
||||
entry_path, -dirhandle, request_entry_id));
|
||||
return(dirhandle);
|
||||
}
|
||||
response[0] = (uint8)dirhandle;
|
||||
response[1] = (uint8)eff_rights;
|
||||
XDPRINTF((3,0, "AFP Alloc Temporary Dir Handle: vol=%d request_vol=%d entry=0x%08x path='%s' dir_handle=%d rights=0x%x entry-id",
|
||||
XDPRINTF((3,0, "INFO AFP 35/11 DONE vol=%d request_vol=%d entry=%u path='%s' dir_handle=%d rights=%u mode='entry-id' fn=0x23 sub=0x0b entry_hex=0x%08x rights_hex=0x%03x",
|
||||
path_volume, (int)volume_number, request_entry_id,
|
||||
entry_path, dirhandle, eff_rights));
|
||||
entry_path, dirhandle, eff_rights, request_entry_id, eff_rights));
|
||||
return(2);
|
||||
}
|
||||
|
||||
path_volume = afp_resolve_path_volume(afp_req + 7, path_len,
|
||||
unixname, sizeof(unixname));
|
||||
if (path_volume < 0) {
|
||||
XDPRINTF((2,0, "AFP Alloc Temporary Dir Handle path resolve failed: request_vol=%d entry=0x%08x path='%s' result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN MAP 35/11 FAIL reason=path_resolve request_vol=%d entry=%u path='%s' result=0x%x fn=0x23 sub=0x0b entry_hex=0x%08x",
|
||||
(int)volume_number, request_entry_id,
|
||||
visable_data(afp_req + 7, path_len), -path_volume));
|
||||
visable_data(afp_req + 7, path_len), -path_volume, request_entry_id));
|
||||
return(path_volume);
|
||||
}
|
||||
|
||||
dirhandle = nw_alloc_dir_handle(0, afp_req + 7, path_len, 0, 1,
|
||||
(int)(ncprequest->task), &eff_rights);
|
||||
if (dirhandle < 0) {
|
||||
XDPRINTF((2,0, "AFP Alloc Temporary Dir Handle allocation failed: request_vol=%d resolved_vol=%d entry=0x%08x path='%s' result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN MAP 35/11 FAIL reason=dir_handle_alloc request_vol=%d resolved_vol=%d entry=%u path='%s' result=0x%x fn=0x23 sub=0x0b entry_hex=0x%08x",
|
||||
(int)volume_number, path_volume, request_entry_id,
|
||||
visable_data(afp_req + 7, path_len), -dirhandle));
|
||||
visable_data(afp_req + 7, path_len), -dirhandle, request_entry_id));
|
||||
return(dirhandle);
|
||||
}
|
||||
|
||||
response[0] = (uint8)dirhandle;
|
||||
response[1] = (uint8)eff_rights;
|
||||
|
||||
XDPRINTF((3,0, "AFP Alloc Temporary Dir Handle: vol=%d request_vol=%d entry=0x%08x path='%s' dir_handle=%d rights=0x%03x",
|
||||
XDPRINTF((3,0, "INFO AFP 35/11 DONE vol=%d request_vol=%d entry=%u path='%s' dir_handle=%d rights=%u mode='path' fn=0x23 sub=0x0b entry_hex=0x%08x rights_hex=0x%03x",
|
||||
path_volume, (int)volume_number, request_entry_id,
|
||||
visable_data(afp_req + 7, path_len), dirhandle, eff_rights));
|
||||
visable_data(afp_req + 7, path_len), dirhandle, eff_rights, request_entry_id, eff_rights));
|
||||
return(2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user