2 * User FTP Server, Share folders over FTP without being root.
3 * Copyright (C) 2008 Isaac Jurado
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option) any later
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <arpa/inet.h>
24 void init_session (int control_sk
)
29 /* Basic initializations */
30 SS
.control_sk
= control_sk
;
45 /* Get local an remote addresses to perform some safety checks when
46 * opening data connections */
47 sai_len
= sizeof(struct sockaddr_in
);
48 e
= getsockname(control_sk
, (struct sockaddr
*) &SS
.local_address
,
51 fatal("Getting local socket address");
53 sai_len
= sizeof(struct sockaddr_in
);
54 e
= getpeername(control_sk
, (struct sockaddr
*) &SS
.client_address
,
57 fatal("Getting remote socket address");
59 notice("Attending new client from %s",
60 inet_ntoa(SS
.client_address
.sin_addr
));
61 reply_c("220 User FTP Server ready.\r\n");