View | Details | Raw Unified | Return to bug 1400 | Differences between
and this patch

Collapse All | Expand All

(-)sftp-server.c (-1 / +24 lines)
Lines 482-487 process_init(void) Link Here
482
	buffer_init(&msg);
482
	buffer_init(&msg);
483
	buffer_put_char(&msg, SSH2_FXP_VERSION);
483
	buffer_put_char(&msg, SSH2_FXP_VERSION);
484
	buffer_put_int(&msg, SSH2_FILEXFER_VERSION);
484
	buffer_put_int(&msg, SSH2_FILEXFER_VERSION);
485
	/* POSIX rename extension */
486
	buffer_put_cstring(&msg, "posix-rename@openssh.com");
487
	buffer_put_cstring(&msg, "1"); /* version */
485
	send_msg(&msg);
488
	send_msg(&msg);
486
	buffer_free(&msg);
489
	buffer_free(&msg);
487
}
490
}
Lines 1059-1064 process_symlink(void) Link Here
1059
}
1062
}
1060
1063
1061
static void
1064
static void
1065
process_extended_posix_rename(u_int32_t id)
1066
{
1067
	char *oldpath, *newpath;
1068
1069
	oldpath = get_string(NULL);
1070
	newpath = get_string(NULL);
1071
	debug3("request %u: posix-rename", id);
1072
	logit("posix-rename old \"%s\" new \"%s\"", oldpath, newpath);
1073
        if (rename(oldpath, newpath) == -1)
1074
            send_status(id, errno_to_portable(errno));
1075
        else
1076
            send_status(id, SSH2_FX_OK);
1077
	xfree(oldpath);
1078
	xfree(newpath);
1079
}
1080
1081
static void
1062
process_extended(void)
1082
process_extended(void)
1063
{
1083
{
1064
	u_int32_t id;
1084
	u_int32_t id;
Lines 1066-1072 process_extended(void) Link Here
1066
1086
1067
	id = get_int();
1087
	id = get_int();
1068
	request = get_string(NULL);
1088
	request = get_string(NULL);
1069
	send_status(id, SSH2_FX_OP_UNSUPPORTED);		/* MUST */
1089
	if (strcmp(request, "posix-rename@openssh.com") == 0)
1090
		process_extended_posix_rename(id);
1091
	else
1092
		send_status(id, SSH2_FX_OP_UNSUPPORTED);	/* MUST */
1070
	xfree(request);
1093
	xfree(request);
1071
}
1094
}
1072
1095

Return to bug 1400