sftp.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2001,2002 Damien Miller. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
#pragma ident "%Z%%M% %I% %E% SMI"
/* XXX: short-form remote directory listings (like 'ls -C') */
#include "buffer.h"
#include "xmalloc.h"
#include "log.h"
#include "pathnames.h"
#include "misc.h"
#include "sftp.h"
#include "sftp-common.h"
#include "sftp-client.h"
#include "sftp-int.h"
#ifdef HAVE___PROGNAME
extern char *__progname;
#else
char *__progname;
#endif
static void
{
#ifdef USE_PIPES
#else /* USE_PIPES */
int inout[2];
#endif /* USE_PIPES */
else if (*sshpid == 0) {
exit(1);
}
exit(1);
}
}
static void
usage(void)
{
extern char *__progname;
gettext("Usage: %s [-vC1] [-b batchfile] [-o option] "
"[-s subsystem|path]\n"
" [-F config] [-P direct server path] [-S program] "
"[-B buffer_size]\n"
" [-R num_requests] [user@]host[:file [file]]\n"),
exit(1);
}
int
{
extern int optind;
extern char *optarg;
switch (ch) {
case 'C':
break;
case 'v':
if (debug_level < 3) {
}
debug_level++;
break;
case 'F':
case 'o':
break;
case '1':
sshver = 1;
if (sftp_server == NULL)
break;
case 's':
break;
case 'S':
break;
case 'b':
} else
fatal("Filename already specified.");
break;
case 'P':
break;
case 'B':
break;
case 'R':
fatal("Invalid number of requests \"%s\"",
optarg);
break;
case 'h':
default:
usage();
}
}
if (sftp_direct == NULL) {
usage();
*cp++ = '\0';
}
else {
*host++ = '\0';
if (!userhost[0]) {
usage();
}
}
if (!*host) {
usage();
}
/* no subsystem if the server-spec contains a '/' */
sftp_server : "sftp"));
&sshpid);
} else {
&sshpid);
}
#if !defined(USE_PIPES)
#endif
fatal("Couldn't wait for ssh process: %s",
return (0);
}