Apply patch: ncpfs-hg-commit-404.patch
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
Copyright (C) 1995, 1996 by Volker Lendecke
|
||||
Copyright (C) 1999-2001 Petr Vandrovec
|
||||
Copyright (C) 1999 Roumen Petrov
|
||||
Copyright (C) 2005 Scott Bentley
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -70,6 +71,9 @@
|
||||
Added NULL parameter checks.
|
||||
Added checks for legal reply sizes from server.
|
||||
|
||||
1.11 2005, May Scott Bentley
|
||||
Added ncp_ns_scan_salvageable_file2.
|
||||
Added ncp_ns_salvage_file.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -1702,6 +1706,34 @@ quit:;
|
||||
return result;
|
||||
}
|
||||
|
||||
long
|
||||
ncp_ns_salvage_file(struct ncp_conn* conn,
|
||||
u_int8_t src_ns,
|
||||
const struct ncp_deleted_file* finfo,
|
||||
const char* newfname)
|
||||
{
|
||||
long result;
|
||||
|
||||
if (!finfo) {
|
||||
return ERR_NULL_POINTER;
|
||||
}
|
||||
|
||||
ncp_init_request(conn);
|
||||
ncp_add_byte(conn, 17); //subfunction: Recover Salvageable File
|
||||
ncp_add_byte(conn, src_ns); //Namespace to use
|
||||
ncp_add_byte(conn, 0); //Reserved
|
||||
ncp_add_dword_lh(conn, finfo->seq);//File id
|
||||
ncp_add_dword_lh(conn, finfo->vol);//Volume id
|
||||
ncp_add_dword_lh(conn, finfo->base);//Directory id
|
||||
ncp_add_pstring(conn, newfname);
|
||||
|
||||
//ncp_add_pstring(conn, newfname);//Not used because it has 255 char limit
|
||||
/* fn: 87 , subfn: 17 */
|
||||
result = ncp_request(conn, 87);
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
|
||||
long
|
||||
ncp_ns_purge_file(struct ncp_conn* conn,
|
||||
const struct ncp_deleted_file* finfo)
|
||||
@@ -2516,6 +2548,56 @@ static NWCCODE ncp_ns_extract_file_info(
|
||||
return NWE_BUFFER_INVALID_LEN;
|
||||
}
|
||||
|
||||
long
|
||||
ncp_ns_scan_salvageable_file2(struct ncp_conn* conn, u_int8_t src_ns,
|
||||
int dirstyle,
|
||||
u_int8_t vol_num, u_int32_t dir_base,
|
||||
const unsigned char *encpath, int pathlen,
|
||||
struct ncp_deleted_file* finfo,
|
||||
struct NSI_Change* dinfo,
|
||||
u_int32_t rim,
|
||||
void *target, size_t sizeoftarget)
|
||||
{
|
||||
long result;
|
||||
NWCCODE err;
|
||||
|
||||
ncp_init_request(conn);
|
||||
ncp_add_byte(conn, 0x10);
|
||||
ncp_add_byte(conn, src_ns);
|
||||
ncp_add_byte(conn, 0);
|
||||
ncp_add_dword_lh(conn, rim);
|
||||
ncp_add_dword_lh(conn, finfo->seq);
|
||||
result = ncp_add_handle_path2(conn, vol_num, dir_base, dirstyle, encpath, pathlen);
|
||||
if (result) {
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
result = ncp_request(conn, 0x57);
|
||||
if (result) {
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
if (conn->ncp_reply_size < 0x61) {
|
||||
ncp_unlock_conn(conn);
|
||||
return NWE_INVALID_NCP_PACKET_LENGTH;
|
||||
}
|
||||
|
||||
finfo->seq = ncp_reply_dword_lh(conn, 0x00);
|
||||
finfo->vol = ncp_reply_dword_lh(conn, 0x0C);
|
||||
finfo->base = ncp_reply_dword_lh(conn, 0x10);
|
||||
|
||||
dinfo->Time = ncp_reply_word_lh(conn, 0x04);
|
||||
dinfo->Date = ncp_reply_word_lh(conn, 0x06);
|
||||
dinfo->ID = ncp_reply_dword_hl(conn, 0x08);
|
||||
|
||||
err = ncp_ns_extract_file_info(NULL, rim,
|
||||
ncp_reply_data(conn, 20), conn->ncp_reply_size - 20,
|
||||
target, sizeoftarget);
|
||||
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
|
||||
static const size_t field_sizes[32] = {
|
||||
/* NSIF_NAME */ sizeof(size_t), /* + */
|
||||
/* NSIF_SPACE_ALLOCATED */ sizeof(u_int32_t),
|
||||
|
||||
@@ -617,3 +617,8 @@ NCPFS_2.2.1 {
|
||||
NCPFS_2.2.4 {
|
||||
ncp_change_job_position;
|
||||
};
|
||||
|
||||
NCPFS_2.2.7 {
|
||||
ncp_ns_salvage_file;
|
||||
ncp_ns_scan_salvageable_file2;
|
||||
};
|
||||
|
||||
@@ -94,6 +94,8 @@ int ncp_alloc_short_dir_handle(addr, addr, uint, addr);
|
||||
int ncp_get_effective_dir_rights(addr, addr, addr);
|
||||
int ncp_add_trustee_set(addr, uint, uint, uint, int, addr);
|
||||
int ncp_ns_scan_salvageable_file(addr, uint, int, uint, uint, addr, uint, addr, addr, uint);
|
||||
int ncp_ns_scan_salvageable_file2(addr, uint, int, uint, uint, addr, int, addr, addr, uint, addr, uint);
|
||||
int ncp_ns_salvage_file(addr, uint, addr, addr);
|
||||
int ncp_ns_purge_file(addr, addr);
|
||||
int ncp_ns_get_full_name(addr, uint, uint, int, uint, uint, addr, uint, addr, uint);
|
||||
int ncp_get_conn_type(addr);
|
||||
|
||||
Reference in New Issue
Block a user