log: normalize AFP entry-id messages
This commit is contained in:
72
src/nwconn.c
72
src/nwconn.c
@@ -653,7 +653,7 @@ static int afp_get_entry_id_from_name(uint8 *afp_req, int afp_len,
|
||||
int result;
|
||||
|
||||
if (afp_len < 7) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Name rejected: short request len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/4 REJECT reason=short_request len=%d fn=0x23 sub=0x04 result=0x7e",
|
||||
afp_len));
|
||||
return(-0x7e); /* NCP Boundary Check Failed */
|
||||
}
|
||||
@@ -662,19 +662,19 @@ static int afp_get_entry_id_from_name(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 Get Entry ID From Name rejected: boundary check len=%d path_len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/4 REJECT reason=boundary_check len=%d path_len=%d fn=0x23 sub=0x04 result=0x7e",
|
||||
afp_len, path_len));
|
||||
return(-0x7e);
|
||||
}
|
||||
|
||||
if (!nwatalk_backend_available()) {
|
||||
XDPRINTF((3,0, "AFP Get Entry ID From Name rejected: AFP xattr metadata backend unavailable"));
|
||||
XDPRINTF((3,0, "WARN AFP 35/4 REJECT reason=xattr_backend_unavailable fn=0x23 sub=0x04 result=0xbf"));
|
||||
return(-0xbf); /* invalid namespace */
|
||||
}
|
||||
|
||||
if (!path_len) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Name rejected: missing path vol=%d entry=0x%08x",
|
||||
(int)volume_number, request_entry_id));
|
||||
XDPRINTF((2,0, "WARN AFP 35/4 REJECT reason=missing_path vol=%d entry=%u fn=0x23 sub=0x04 entry_hex=0x%08x result=0x9c",
|
||||
(int)volume_number, request_entry_id, request_entry_id));
|
||||
return(-0x9c); /* Invalid Path */
|
||||
}
|
||||
|
||||
@@ -687,8 +687,8 @@ static int afp_get_entry_id_from_name(uint8 *afp_req, int afp_len,
|
||||
request_entry_id,
|
||||
base_path, sizeof(base_path));
|
||||
if (result) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Name base lookup failed: vol=%d entry=0x%08x result=-0x%x",
|
||||
(int)volume_number, request_entry_id, -result));
|
||||
XDPRINTF((2,0, "WARN MAP 35/4 FAIL reason=entry_id_base_lookup vol=%d entry=%u result=0x%x fn=0x23 sub=0x04 entry_hex=0x%08x",
|
||||
(int)volume_number, request_entry_id, -result, request_entry_id));
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -706,9 +706,10 @@ static int afp_get_entry_id_from_name(uint8 *afp_req, int afp_len,
|
||||
volume = conn_get_kpl_unxname(unixname, sizeof(unixname), 0,
|
||||
(uint8 *)entry_path, used);
|
||||
if (volume < 0) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Name relative path resolve failed: vol=%d entry=0x%08x base='%s' name='%s' path='%s' result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN MAP 35/4 FAIL reason=relative_path_resolve vol=%d entry=%u base='%s' name='%s' path='%s' result=0x%x fn=0x23 sub=0x04 entry_hex=0x%08x",
|
||||
(int)volume_number, request_entry_id, base_path,
|
||||
visable_data(afp_req + 7, path_len), entry_path, -volume));
|
||||
visable_data(afp_req + 7, path_len), entry_path, -volume,
|
||||
request_entry_id));
|
||||
return(volume);
|
||||
}
|
||||
} else {
|
||||
@@ -716,27 +717,28 @@ static int afp_get_entry_id_from_name(uint8 *afp_req, int afp_len,
|
||||
afp_req + 7, path_len);
|
||||
}
|
||||
if (volume < 0) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Name path resolve failed: vol=%d entry=0x%08x path='%s' result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN MAP 35/4 FAIL reason=path_resolve vol=%d entry=%u path='%s' result=0x%x fn=0x23 sub=0x04 entry_hex=0x%08x",
|
||||
(int)volume_number, request_entry_id,
|
||||
visable_data(afp_req + 7, path_len), -volume));
|
||||
visable_data(afp_req + 7, path_len), -volume, request_entry_id));
|
||||
return(volume);
|
||||
}
|
||||
|
||||
if (stat(unixname, &stbuff)) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Name stat failed: vol=%d entry=0x%08x path='%s' unix='%s' errno=%d",
|
||||
XDPRINTF((2,0, "WARN FILE 35/4 FAIL reason=stat vol=%d entry=%u path='%s' unix='%s' errno=%d fn=0x23 sub=0x04 entry_hex=0x%08x result=0x9c",
|
||||
(int)volume_number, request_entry_id,
|
||||
visable_data(afp_req + 7, path_len), unixname, errno));
|
||||
visable_data(afp_req + 7, path_len), unixname, errno,
|
||||
request_entry_id));
|
||||
return(-0x9c); /* Invalid Path */
|
||||
}
|
||||
|
||||
entry_id = afp_get_or_create_entry_id(unixname, volume, &stbuff, &result);
|
||||
|
||||
U32_TO_BE32(entry_id, response);
|
||||
XDPRINTF((3,0, "AFP Get Entry ID From Name: vol=%d entry=0x%08x path='%s' reply_entry=0x%08x%s%s",
|
||||
XDPRINTF((3,0, "INFO AFP 35/4 DONE vol=%d entry=%u path='%s' reply_entry=%u mode='%s%s' fn=0x23 sub=0x04 entry_hex=0x%08x reply_entry_hex=0x%08x",
|
||||
(int)volume_number, request_entry_id,
|
||||
visable_data(afp_req + 7, path_len), entry_id,
|
||||
request_entry_id ? " entry-id" : "",
|
||||
result ? " fallback" : ""));
|
||||
request_entry_id ? "entry-id" : "",
|
||||
result ? " fallback" : "", request_entry_id, entry_id));
|
||||
return(4);
|
||||
}
|
||||
|
||||
@@ -752,7 +754,7 @@ static int afp_get_entry_id_from_netware_handle(uint8 *afp_req, int afp_len,
|
||||
int result;
|
||||
|
||||
if (afp_len < 7) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From NetWare Handle rejected: short request len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/6 REJECT reason=short_request len=%d fn=0x23 sub=0x06 result=0x7e",
|
||||
afp_len));
|
||||
return(-0x7e); /* NCP Boundary Check Failed */
|
||||
}
|
||||
@@ -760,18 +762,18 @@ static int afp_get_entry_id_from_netware_handle(uint8 *afp_req, int afp_len,
|
||||
fhandle = GET_32(afp_req + 3); /* bytes 1..2 are the extended handle */
|
||||
unixname = file_get_unix_name(fhandle);
|
||||
if (!unixname) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From NetWare Handle rejected: bad handle=%u",
|
||||
XDPRINTF((2,0, "WARN FILE 35/6 REJECT reason=bad_handle handle=%u fn=0x23 sub=0x06 result=0x88",
|
||||
fhandle));
|
||||
return(-0x88); /* Invalid File Handle */
|
||||
}
|
||||
|
||||
if (!nwatalk_backend_available()) {
|
||||
XDPRINTF((3,0, "AFP Get Entry ID From NetWare Handle rejected: AFP xattr metadata backend unavailable"));
|
||||
XDPRINTF((3,0, "WARN AFP 35/6 REJECT reason=xattr_backend_unavailable fn=0x23 sub=0x06 result=0xbf"));
|
||||
return(-0xbf); /* invalid namespace */
|
||||
}
|
||||
|
||||
if (stat((char *)unixname, &stbuff)) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From NetWare Handle stat failed: handle=%u unix='%s' errno=%d",
|
||||
XDPRINTF((2,0, "WARN FILE 35/6 FAIL reason=stat handle=%u unix='%s' errno=%d fn=0x23 sub=0x06 result=0x88",
|
||||
fhandle, unixname, errno));
|
||||
return(-0x88); /* Invalid File Handle */
|
||||
}
|
||||
@@ -785,9 +787,9 @@ static int afp_get_entry_id_from_netware_handle(uint8 *afp_req, int afp_len,
|
||||
U32_TO_BE32(entry_id, response + 1);
|
||||
response[5] = 0; /* data fork */
|
||||
|
||||
XDPRINTF((3,0, "AFP Get Entry ID From NetWare Handle: handle=%u volume=%d unix='%s' entry=0x%08x%s",
|
||||
XDPRINTF((3,0, "INFO AFP 35/6 DONE handle=%u vol=%d unix='%s' entry=%u mode='%s' fn=0x23 sub=0x06 entry_hex=0x%08x",
|
||||
fhandle, volume, unixname, entry_id,
|
||||
result ? " fallback" : ""));
|
||||
result ? "fallback" : "", entry_id));
|
||||
return(6);
|
||||
}
|
||||
|
||||
@@ -1454,7 +1456,7 @@ static int afp_get_entry_id_from_path_name(uint8 *afp_req, int afp_len,
|
||||
int result;
|
||||
|
||||
if (afp_len < 3) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Path Name rejected: short request len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/12 REJECT reason=short_request len=%d fn=0x23 sub=0x0c result=0x7e",
|
||||
afp_len));
|
||||
return(-0x7e); /* NCP Boundary Check Failed */
|
||||
}
|
||||
@@ -1462,26 +1464,26 @@ static int afp_get_entry_id_from_path_name(uint8 *afp_req, int afp_len,
|
||||
dir_handle = afp_req[1];
|
||||
path_len = (int)afp_req[2];
|
||||
if (path_len < 0 || afp_len < 3 + path_len) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Path Name rejected: boundary check len=%d path_len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/12 REJECT reason=boundary_check len=%d path_len=%d fn=0x23 sub=0x0c result=0x7e",
|
||||
afp_len, path_len));
|
||||
return(-0x7e);
|
||||
}
|
||||
|
||||
if (!nwatalk_backend_available()) {
|
||||
XDPRINTF((3,0, "AFP Get Entry ID From Path Name rejected: AFP xattr metadata backend unavailable"));
|
||||
XDPRINTF((3,0, "WARN AFP 35/12 REJECT reason=xattr_backend_unavailable fn=0x23 sub=0x0c result=0xbf"));
|
||||
return(-0xbf); /* invalid namespace */
|
||||
}
|
||||
|
||||
volume = conn_get_kpl_unxname(unixname, sizeof(unixname),
|
||||
(int)dir_handle, afp_req + 3, path_len);
|
||||
if (volume < 0) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Path Name path resolve failed: dh=%d path='%s' result=-0x%x",
|
||||
XDPRINTF((2,0, "WARN MAP 35/12 FAIL reason=path_resolve dh=%d path='%s' result=0x%x fn=0x23 sub=0x0c",
|
||||
(int)dir_handle, visable_data(afp_req + 3, path_len), -volume));
|
||||
return(volume);
|
||||
}
|
||||
|
||||
if (stat(unixname, &stbuff)) {
|
||||
XDPRINTF((2,0, "AFP Get Entry ID From Path Name stat failed: dh=%d path='%s' unix='%s' errno=%d",
|
||||
XDPRINTF((2,0, "WARN FILE 35/12 FAIL reason=stat dh=%d path='%s' unix='%s' errno=%d fn=0x23 sub=0x0c result=0x9c",
|
||||
(int)dir_handle, visable_data(afp_req + 3, path_len),
|
||||
unixname, errno));
|
||||
return(-0x9c); /* Invalid Path */
|
||||
@@ -1490,9 +1492,9 @@ static int afp_get_entry_id_from_path_name(uint8 *afp_req, int afp_len,
|
||||
entry_id = afp_get_or_create_entry_id(unixname, volume, &stbuff, &result);
|
||||
|
||||
U32_TO_BE32(entry_id, response);
|
||||
XDPRINTF((3,0, "AFP Get Entry ID From Path Name: dh=%d path='%s' entry=0x%08x%s",
|
||||
XDPRINTF((3,0, "INFO AFP 35/12 DONE dh=%d path='%s' entry=%u mode='%s' fn=0x23 sub=0x0c entry_hex=0x%08x",
|
||||
(int)dir_handle, visable_data(afp_req + 3, path_len), entry_id,
|
||||
result ? " fallback" : ""));
|
||||
result ? "fallback" : "", entry_id));
|
||||
return(4);
|
||||
}
|
||||
|
||||
@@ -1724,7 +1726,7 @@ static int afp_get_dos_name_from_entry_id(uint8 *afp_req, int afp_len,
|
||||
int len;
|
||||
|
||||
if (afp_len < 6) {
|
||||
XDPRINTF((2,0, "AFP Get DOS Name From Entry ID rejected: short request len=%d",
|
||||
XDPRINTF((2,0, "WARN AFP 35/18 REJECT reason=short_request len=%d fn=0x23 sub=0x12 result=0x7e",
|
||||
afp_len));
|
||||
return(-0x7e); /* NCP Boundary Check Failed */
|
||||
}
|
||||
@@ -1733,7 +1735,7 @@ static int afp_get_dos_name_from_entry_id(uint8 *afp_req, int afp_len,
|
||||
entry_id = GET_BE32(afp_req + 2);
|
||||
|
||||
if (!nwatalk_backend_available()) {
|
||||
XDPRINTF((3,0, "AFP Get DOS Name From Entry ID rejected: AFP xattr metadata backend unavailable"));
|
||||
XDPRINTF((3,0, "WARN AFP 35/18 REJECT reason=xattr_backend_unavailable fn=0x23 sub=0x12 result=0xbf"));
|
||||
return(-0xbf); /* Invalid Namespace */
|
||||
}
|
||||
|
||||
@@ -1746,8 +1748,8 @@ static int afp_get_dos_name_from_entry_id(uint8 *afp_req, int afp_len,
|
||||
entry_id, path,
|
||||
sizeof(path));
|
||||
if (legacy_result) {
|
||||
XDPRINTF((2,0, "AFP Get DOS Name From Entry ID lookup failed: vol=%d entry=0x%08x namespace=-0x%x legacy=-0x%x",
|
||||
(int)volume_number, entry_id, -result, -legacy_result));
|
||||
XDPRINTF((2,0, "WARN MAP 35/18 FAIL reason=entry_id_lookup vol=%d entry=%u namespace=0x%x legacy=0x%x fn=0x23 sub=0x12 entry_hex=0x%08x result=0x9c",
|
||||
(int)volume_number, entry_id, -result, -legacy_result, entry_id));
|
||||
return(legacy_result);
|
||||
}
|
||||
}
|
||||
@@ -1757,8 +1759,8 @@ static int afp_get_dos_name_from_entry_id(uint8 *afp_req, int afp_len,
|
||||
response[0] = (uint8)len;
|
||||
memcpy(response + 1, path, len);
|
||||
|
||||
XDPRINTF((3,0, "AFP Get DOS Name From Entry ID: vol=%d entry=0x%08x path='%s'",
|
||||
(int)volume_number, entry_id, path));
|
||||
XDPRINTF((3,0, "INFO AFP 35/18 DONE vol=%d entry=%u path='%s' fn=0x23 sub=0x12 entry_hex=0x%08x",
|
||||
(int)volume_number, entry_id, path, entry_id));
|
||||
return(1 + len);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user