No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / external / bsd / openssh / dist / sftp-server-main.c
blob2ce95885773e6b7772ddabcd61ecff5bee6497d3
1 /* $NetBSD$ */
2 /* $OpenBSD: sftp-server-main.c,v 1.4 2009/02/21 19:32:04 tobias Exp $ */
3 /*
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.
19 #include "includes.h"
20 __RCSID("$NetBSD: sftp-server-main.c,v 1.2 2009/02/16 20:53:55 christos Exp $");
21 #include <sys/types.h>
22 #include <pwd.h>
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include <unistd.h>
26 #include <time.h>
28 #include "log.h"
29 #include "sftp.h"
30 #include "misc.h"
32 void
33 cleanup_exit(int i)
35 sftp_server_cleanup_exit(i);
38 int
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 */
44 sanitise_stdfd();
46 if ((user_pw = getpwuid(getuid())) == NULL) {
47 fprintf(stderr, "No user found for uid %lu\n",
48 (u_long)getuid());
49 return 1;
52 return (sftp_server_main(argc, argv, user_pw));