Index: session.c
--- session.c.orig	2009-08-20 08:20:50 +0200
+++ session.c	2009-10-02 13:12:14 +0200
@@ -101,6 +101,10 @@
 	  c[sizeof(INTERNAL_SFTP_NAME) - 1] == ' ' || \
 	  c[sizeof(INTERNAL_SFTP_NAME) - 1] == '\t'))
 
+#ifndef SCPBINDIR
+#define SCPBINDIR "@l_prefix@/bin"
+#endif
+
 /* func */
 
 Session *session_new(void);
@@ -781,6 +785,20 @@
 do_exec(Session *s, const char *command)
 {
 	int ret;
+	char *scp_command = NULL;
+
+	if (   command != NULL
+		&& strlen(command) >= 3
+		&& strncmp(command, "scp", 3) == 0
+		&& (command[3] == ' ' || command[3] == '\0')) {
+		size_t l, k;
+		l = strlen(SCPBINDIR);
+		k = strlen(command);
+		scp_command = xmalloc(l+1+k+1);
+		snprintf(scp_command, l+1+k+1, "%s/%s", SCPBINDIR, command);
+		command = (const char *)scp_command;
+		debug("Forced SCP command '%.900s'", command);
+	}
 
 	if (options.adm_forced_command) {
 		original_command = command;
@@ -817,6 +835,8 @@
 		ret = do_exec_no_pty(s, command);
 
 	original_command = NULL;
+	if (scp_command != NULL)
+		(scp_command);
 
 	/*
 	 * Clear loginmsg: it's the child's responsibility to display
