1 | /* |
---|
2 | * bbftpc/bbftp_private_user.c |
---|
3 | * Copyright (C) 1999, 2000, 2001, 2002 IN2P3, CNRS |
---|
4 | * bbftp@in2p3.fr |
---|
5 | * http://doc.in2p3.fr/bbftp |
---|
6 | * |
---|
7 | * This program is free software; you can redistribute it and/or |
---|
8 | * modify it under the terms of the GNU General Public License |
---|
9 | * as published by the Free Software Foundation; either version 2 |
---|
10 | * of the License, or any later version. |
---|
11 | * |
---|
12 | * This program is distributed in the hope that it will be useful, |
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | * GNU General Public License for more details. |
---|
16 | * |
---|
17 | * You should have received a copy of the GNU General Public License |
---|
18 | * along with this program; if not, write to the Free Software |
---|
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
20 | */ |
---|
21 | |
---|
22 | /**************************************************************************** |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | bbftp_private_user.c v 2.1.0 2001/05/21 - Routines creation |
---|
27 | |
---|
28 | *****************************************************************************/ |
---|
29 | #include <stdio.h> |
---|
30 | |
---|
31 | #include <bbftp_private_user.h> |
---|
32 | |
---|
33 | /* |
---|
34 | ** username contain a pointer to the string given with the -u flag |
---|
35 | */ |
---|
36 | extern char *username ; |
---|
37 | /* |
---|
38 | ** privatestr contain a pointer to the string given with the -P flag |
---|
39 | */ |
---|
40 | extern char *privatestr ; |
---|
41 | |
---|
42 | /******************************************************************************* |
---|
43 | ** bbftp_private_getargs : * |
---|
44 | ** * |
---|
45 | ** Routine to get arguments for private authentication. This routine is * |
---|
46 | ** called after several tests have been made. The variable to be set are * |
---|
47 | ** to be define in bbftp_private_user.h to be used by other routines. * |
---|
48 | ** * |
---|
49 | ** OUPUT variable : * |
---|
50 | ** logmessage : to write the error message in case of error * |
---|
51 | ** * |
---|
52 | ** GLOBAL VARIABLE USED : * * |
---|
53 | ** * |
---|
54 | ** RETURN: * |
---|
55 | ** -1 Unrecoverable error * |
---|
56 | ** 0 OK * |
---|
57 | ** * |
---|
58 | *******************************************************************************/ |
---|
59 | |
---|
60 | int bbftp_private_getargs(char *logmessage) |
---|
61 | { |
---|
62 | return 0 ; |
---|
63 | } |
---|
64 | |
---|
65 | /******************************************************************************* |
---|
66 | ** bbftp_private_auth : * |
---|
67 | ** * |
---|
68 | ** Routine to do the private authentication. This routine just have to * |
---|
69 | ** send or to receive private data to the bbftpd daemon. For that it will * |
---|
70 | ** use the two routines : * |
---|
71 | ** bbftp_private_send * |
---|
72 | ** bbftp_private_recv * |
---|
73 | ** The reception of the OK or BAD message will be done by the calling * |
---|
74 | ** routine, so if this routine has no check to do (for example just * |
---|
75 | ** sending username and password) it will just call bbftp_private_send * |
---|
76 | ** twice and let the calling program check if it is OK or BAD. * |
---|
77 | ** * |
---|
78 | ** The bbftp_private_send routine has to be called with the following * |
---|
79 | ** parameters: * |
---|
80 | ** * |
---|
81 | ** int bbftp_private_send(char *buffertosend,int buffertosendlength, * |
---|
82 | ** char *logmessage) * |
---|
83 | ** char *buffertosend = string to be send to the daemon * |
---|
84 | ** int buffertosendlength = length of the string * |
---|
85 | ** char *logmessage * |
---|
86 | ** * |
---|
87 | ** and return 0 in case of success, -1 in case of error with logmessage * |
---|
88 | ** filled * |
---|
89 | ** * |
---|
90 | ** The bbftp_private_recv routine has to be called with the following * |
---|
91 | ** parameters: * |
---|
92 | ** * |
---|
93 | ** int bbftp_private_recv(char *buffertorecv,int lengthtoreceive, * |
---|
94 | ** char *logmessage) * |
---|
95 | ** char *buffertorecv = buffer to put data received from the * |
---|
96 | ** daemon * |
---|
97 | ** int lengthtorecv = length of the buffer * |
---|
98 | ** char *logmessage * |
---|
99 | ** * |
---|
100 | ** and return number of byte received in case of success, -1 in case of * |
---|
101 | ** error with logmessage filled * |
---|
102 | ** It is the duty of the programmer to be sure that the buffer is large * |
---|
103 | ** enought * |
---|
104 | ** * |
---|
105 | ** * |
---|
106 | ** OUPUT variable : * |
---|
107 | ** logmessage : to write the error message in case of error * |
---|
108 | ** * |
---|
109 | ** GLOBAL VARIABLE USED : * |
---|
110 | ** * |
---|
111 | ** RETURN: * |
---|
112 | ** -1 Unrecoverable error * |
---|
113 | ** 0 OK * |
---|
114 | ** * |
---|
115 | *******************************************************************************/ |
---|
116 | |
---|
117 | int bbftp_private_auth(char *logmessage) |
---|
118 | { |
---|
119 | |
---|
120 | return 0 ; |
---|
121 | } |
---|