diff options
author | Damien Miller <djm@mindrot.org> | 2001-02-04 23:20:18 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2001-02-04 23:20:18 +1100 |
commit | 33804263583e82fb7e6e36477fe63ebd14f15ecb (patch) | |
tree | 90d891bedf231b49acdd91f456d58a4142070bd6 /sftp-server.c | |
parent | 45cb2937bc8a74c1e1f7da3b35ad4319d3033baf (diff) |
NB: big update - may break stuff. Please test!
- (djm) OpenBSD CVS sync:
- markus@cvs.openbsd.org 2001/02/03 03:08:38
[auth-options.c auth-rh-rsa.c auth-rhosts.c auth.c canohost.c]
[canohost.h servconf.c servconf.h session.c sshconnect1.c sshd.8]
[sshd_config]
make ReverseMappingCheck optional in sshd_config; ok djm@,dugsong@
- markus@cvs.openbsd.org 2001/02/03 03:19:51
[ssh.1 sshd.8 sshd_config]
Skey is now called ChallengeResponse
- markus@cvs.openbsd.org 2001/02/03 03:43:09
[sshd.8]
use no-pty option in .ssh/authorized_keys* if you need a 8-bit clean
channel. note from Erik.Anggard@cygate.se (pr/1659)
- stevesk@cvs.openbsd.org 2001/02/03 10:03:06
[ssh.1]
typos; ok markus@
- djm@cvs.openbsd.org 2001/02/04 04:11:56
[scp.1 sftp-server.c ssh.1 sshd.8 sftp-client.c sftp-client.h]
[sftp-common.c sftp-common.h sftp-int.c sftp-int.h sftp.1 sftp.c]
Basic interactive sftp client; ok theo@
- (djm) Update RPM specs for new sftp binary
- (djm) Update several bits for new optional reverse lookup stuff. I
think I got them all.
Diffstat (limited to 'sftp-server.c')
-rw-r--r-- | sftp-server.c | 102 |
1 files changed, 3 insertions, 99 deletions
diff --git a/sftp-server.c b/sftp-server.c index a3e11ce5b..0e0040094 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #include "includes.h" | 24 | #include "includes.h" |
25 | RCSID("$OpenBSD: sftp-server.c,v 1.14 2001/01/21 19:05:56 markus Exp $"); | 25 | RCSID("$OpenBSD: sftp-server.c,v 1.15 2001/02/04 11:11:54 djm Exp $"); |
26 | 26 | ||
27 | #include "buffer.h" | 27 | #include "buffer.h" |
28 | #include "bufaux.h" | 28 | #include "bufaux.h" |
@@ -31,6 +31,7 @@ RCSID("$OpenBSD: sftp-server.c,v 1.14 2001/01/21 19:05:56 markus Exp $"); | |||
31 | #include "xmalloc.h" | 31 | #include "xmalloc.h" |
32 | 32 | ||
33 | #include "sftp.h" | 33 | #include "sftp.h" |
34 | #include "sftp-common.h" | ||
34 | 35 | ||
35 | /* helper */ | 36 | /* helper */ |
36 | #define get_int64() buffer_get_int64(&iqueue); | 37 | #define get_int64() buffer_get_int64(&iqueue); |
@@ -50,22 +51,9 @@ Buffer oqueue; | |||
50 | 51 | ||
51 | /* portable attibutes, etc. */ | 52 | /* portable attibutes, etc. */ |
52 | 53 | ||
53 | typedef struct Attrib Attrib; | ||
54 | typedef struct Stat Stat; | 54 | typedef struct Stat Stat; |
55 | 55 | ||
56 | struct Attrib | 56 | struct Stat { |
57 | { | ||
58 | u_int32_t flags; | ||
59 | u_int64_t size; | ||
60 | u_int32_t uid; | ||
61 | u_int32_t gid; | ||
62 | u_int32_t perm; | ||
63 | u_int32_t atime; | ||
64 | u_int32_t mtime; | ||
65 | }; | ||
66 | |||
67 | struct Stat | ||
68 | { | ||
69 | char *name; | 57 | char *name; |
70 | char *long_name; | 58 | char *long_name; |
71 | Attrib attrib; | 59 | Attrib attrib; |
@@ -122,90 +110,6 @@ flags_from_portable(int pflags) | |||
122 | return flags; | 110 | return flags; |
123 | } | 111 | } |
124 | 112 | ||
125 | void | ||
126 | attrib_clear(Attrib *a) | ||
127 | { | ||
128 | a->flags = 0; | ||
129 | a->size = 0; | ||
130 | a->uid = 0; | ||
131 | a->gid = 0; | ||
132 | a->perm = 0; | ||
133 | a->atime = 0; | ||
134 | a->mtime = 0; | ||
135 | } | ||
136 | |||
137 | Attrib * | ||
138 | decode_attrib(Buffer *b) | ||
139 | { | ||
140 | static Attrib a; | ||
141 | attrib_clear(&a); | ||
142 | a.flags = buffer_get_int(b); | ||
143 | if (a.flags & SSH2_FILEXFER_ATTR_SIZE) { | ||
144 | a.size = buffer_get_int64(b); | ||
145 | } | ||
146 | if (a.flags & SSH2_FILEXFER_ATTR_UIDGID) { | ||
147 | a.uid = buffer_get_int(b); | ||
148 | a.gid = buffer_get_int(b); | ||
149 | } | ||
150 | if (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { | ||
151 | a.perm = buffer_get_int(b); | ||
152 | } | ||
153 | if (a.flags & SSH2_FILEXFER_ATTR_ACMODTIME) { | ||
154 | a.atime = buffer_get_int(b); | ||
155 | a.mtime = buffer_get_int(b); | ||
156 | } | ||
157 | /* vendor-specific extensions */ | ||
158 | if (a.flags & SSH2_FILEXFER_ATTR_EXTENDED) { | ||
159 | char *type, *data; | ||
160 | int i, count; | ||
161 | count = buffer_get_int(b); | ||
162 | for (i = 0; i < count; i++) { | ||
163 | type = buffer_get_string(b, NULL); | ||
164 | data = buffer_get_string(b, NULL); | ||
165 | xfree(type); | ||
166 | xfree(data); | ||
167 | } | ||
168 | } | ||
169 | return &a; | ||
170 | } | ||
171 | |||
172 | void | ||
173 | encode_attrib(Buffer *b, Attrib *a) | ||
174 | { | ||
175 | buffer_put_int(b, a->flags); | ||
176 | if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { | ||
177 | buffer_put_int64(b, a->size); | ||
178 | } | ||
179 | if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { | ||
180 | buffer_put_int(b, a->uid); | ||
181 | buffer_put_int(b, a->gid); | ||
182 | } | ||
183 | if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { | ||
184 | buffer_put_int(b, a->perm); | ||
185 | } | ||
186 | if (a->flags & SSH2_FILEXFER_ATTR_ACMODTIME) { | ||
187 | buffer_put_int(b, a->atime); | ||
188 | buffer_put_int(b, a->mtime); | ||
189 | } | ||
190 | } | ||
191 | |||
192 | void | ||
193 | stat_to_attrib(struct stat *st, Attrib *a) | ||
194 | { | ||
195 | attrib_clear(a); | ||
196 | a->flags = 0; | ||
197 | a->flags |= SSH2_FILEXFER_ATTR_SIZE; | ||
198 | a->size = st->st_size; | ||
199 | a->flags |= SSH2_FILEXFER_ATTR_UIDGID; | ||
200 | a->uid = st->st_uid; | ||
201 | a->gid = st->st_gid; | ||
202 | a->flags |= SSH2_FILEXFER_ATTR_PERMISSIONS; | ||
203 | a->perm = st->st_mode; | ||
204 | a->flags |= SSH2_FILEXFER_ATTR_ACMODTIME; | ||
205 | a->atime = st->st_atime; | ||
206 | a->mtime = st->st_mtime; | ||
207 | } | ||
208 | |||
209 | Attrib * | 113 | Attrib * |
210 | get_attrib(void) | 114 | get_attrib(void) |
211 | { | 115 | { |