2 /* $OpenBSD: sftp-server-main.c,v 1.4 2009/02/21 19:32:04 tobias Exp $ */
4 * Copyright (c) 2008 Markus Friedl. All rights reserved.
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 __RCSID("$NetBSD: sftp-server-main.c,v 1.2 2009/02/16 20:53:55 christos Exp $");
21 #include <sys/types.h>
35 sftp_server_cleanup_exit(i
);
39 main(int argc
, char **argv
)
41 struct passwd
*user_pw
;
43 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
46 if ((user_pw
= getpwuid(getuid())) == NULL
) {
47 fprintf(stderr
, "No user found for uid %lu\n",
52 return (sftp_server_main(argc
, argv
, user_pw
));