sftp_pkt_addbyte(pkt, (unsigned char) pkt_type);
return pkt;
}
+/*
static void sftp_pkt_addbool(struct sftp_packet *pkt, unsigned char value)
{
sftp_pkt_adddata(pkt, &value, 1);
}
+*/
static void sftp_pkt_adduint32(struct sftp_packet *pkt,
unsigned long value)
{
static struct sftp_request *sftp_alloc_request(void)
{
- const unsigned CHANNEL_NUMBER_OFFSET = 256;
unsigned low, high, mid;
int tsize;
struct sftp_request *r;
* B-tree to find the largest ID which is in a contiguous
* sequence from the beginning. (Precisely everything in that
* sequence must have ID equal to its tree index plus
- * SEQUENCE_NUMBER_OFFSET.)
+ * REQUEST_ID_OFFSET.)
*/
tsize = count234(sftp_requests);
return NULL;
}
+ del234(sftp_requests, req);
+
return req;
}
return req;
}
-char *fxp_realpath_recv(struct sftp_packet *pktin)
+char *fxp_realpath_recv(struct sftp_packet *pktin, struct sftp_request *req)
{
+ sfree(req);
+
if (pktin->type == SSH_FXP_NAME) {
int count;
char *path;
return req;
}
-struct fxp_handle *fxp_open_recv(struct sftp_packet *pktin)
+struct fxp_handle *fxp_open_recv(struct sftp_packet *pktin,
+ struct sftp_request *req)
{
+ sfree(req);
+
if (pktin->type == SSH_FXP_HANDLE) {
char *hstring;
struct fxp_handle *handle;
return req;
}
-struct fxp_handle *fxp_opendir_recv(struct sftp_packet *pktin)
+struct fxp_handle *fxp_opendir_recv(struct sftp_packet *pktin,
+ struct sftp_request *req)
{
+ sfree(req);
if (pktin->type == SSH_FXP_HANDLE) {
char *hstring;
struct fxp_handle *handle;
return req;
}
-void fxp_close_recv(struct sftp_packet *pktin)
+void fxp_close_recv(struct sftp_packet *pktin, struct sftp_request *req)
{
+ sfree(req);
fxp_got_status(pktin);
sftp_pkt_free(pktin);
}
return req;
}
-int fxp_mkdir_recv(struct sftp_packet *pktin)
+int fxp_mkdir_recv(struct sftp_packet *pktin, struct sftp_request *req)
{
- int id = fxp_got_status(pktin);
+ int id;
+ sfree(req);
+ id = fxp_got_status(pktin);
sftp_pkt_free(pktin);
if (id != 1) {
return 0;
return req;
}
-int fxp_rmdir_recv(struct sftp_packet *pktin)
+int fxp_rmdir_recv(struct sftp_packet *pktin, struct sftp_request *req)
{
- int id = fxp_got_status(pktin);
+ int id;
+ sfree(req);
+ id = fxp_got_status(pktin);
sftp_pkt_free(pktin);
if (id != 1) {
return 0;
return req;
}
-int fxp_remove_recv(struct sftp_packet *pktin)
+int fxp_remove_recv(struct sftp_packet *pktin, struct sftp_request *req)
{
- int id = fxp_got_status(pktin);
+ int id;
+ sfree(req);
+ id = fxp_got_status(pktin);
sftp_pkt_free(pktin);
if (id != 1) {
return 0;
return req;
}
-int fxp_rename_recv(struct sftp_packet *pktin)
+int fxp_rename_recv(struct sftp_packet *pktin, struct sftp_request *req)
{
- int id = fxp_got_status(pktin);
+ int id;
+ sfree(req);
+ id = fxp_got_status(pktin);
sftp_pkt_free(pktin);
if (id != 1) {
return 0;
return req;
}
-int fxp_stat_recv(struct sftp_packet *pktin, struct fxp_attrs *attrs)
+int fxp_stat_recv(struct sftp_packet *pktin, struct sftp_request *req,
+ struct fxp_attrs *attrs)
{
+ sfree(req);
if (pktin->type == SSH_FXP_ATTRS) {
*attrs = sftp_pkt_getattrs(pktin);
sftp_pkt_free(pktin);
return req;
}
-int fxp_fstat_recv(struct sftp_packet *pktin,
+int fxp_fstat_recv(struct sftp_packet *pktin, struct sftp_request *req,
struct fxp_attrs *attrs)
{
+ sfree(req);
if (pktin->type == SSH_FXP_ATTRS) {
*attrs = sftp_pkt_getattrs(pktin);
sftp_pkt_free(pktin);
return req;
}
-int fxp_setstat_recv(struct sftp_packet *pktin)
+int fxp_setstat_recv(struct sftp_packet *pktin, struct sftp_request *req)
{
- int id = fxp_got_status(pktin);
+ int id;
+ sfree(req);
+ id = fxp_got_status(pktin);
sftp_pkt_free(pktin);
if (id != 1) {
return 0;
return req;
}
-int fxp_fsetstat_recv(struct sftp_packet *pktin)
+int fxp_fsetstat_recv(struct sftp_packet *pktin, struct sftp_request *req)
{
- int id = fxp_got_status(pktin);
+ int id;
+ sfree(req);
+ id = fxp_got_status(pktin);
sftp_pkt_free(pktin);
if (id != 1) {
return 0;
return req;
}
-int fxp_read_recv(struct sftp_packet *pktin, char *buffer, int len)
+int fxp_read_recv(struct sftp_packet *pktin, struct sftp_request *req,
+ char *buffer, int len)
{
+ sfree(req);
if (pktin->type == SSH_FXP_DATA) {
char *str;
int rlen;
return req;
}
-struct fxp_names *fxp_readdir_recv(struct sftp_packet *pktin)
+struct fxp_names *fxp_readdir_recv(struct sftp_packet *pktin,
+ struct sftp_request *req)
{
+ sfree(req);
if (pktin->type == SSH_FXP_NAME) {
struct fxp_names *ret;
int i;
return req;
}
-int fxp_write_recv(struct sftp_packet *pktin)
+int fxp_write_recv(struct sftp_packet *pktin, struct sftp_request *req)
{
+ sfree(req);
fxp_got_status(pktin);
sftp_pkt_free(pktin);
return fxp_errtype == SSH_FX_OK;