diff options
author | Damien Miller <djm@mindrot.org> | 2002-02-13 14:10:32 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2002-02-13 14:10:32 +1100 |
commit | 3db5f530d0fdf8044d6014ab12940efe0bbecca7 (patch) | |
tree | 578c5ea0091f934c13d40264b033bbd2532d2e9a /sftp-glob.c | |
parent | 3606ee29388781894e6374030d0e40fa46da4cf9 (diff) |
- djm@cvs.openbsd.org 2002/02/13 00:59:23
[sftp-client.c sftp-client.h sftp-glob.c sftp-glob.h sftp.h]
[sftp-int.c sftp-int.h]
API cleanup and backwards compat for filexfer v.0 servers; ok markus@
Diffstat (limited to 'sftp-glob.c')
-rw-r--r-- | sftp-glob.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/sftp-glob.c b/sftp-glob.c index 849ac65ed..1234074c4 100644 --- a/sftp-glob.c +++ b/sftp-glob.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2001 Damien Miller. All rights reserved. | 2 | * Copyright (c) 2001,2002 Damien Miller. All rights reserved. |
3 | * | 3 | * |
4 | * Redistribution and use in source and binary forms, with or without | 4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions | 5 | * modification, are permitted provided that the following conditions |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: sftp-glob.c,v 1.9 2001/12/19 07:18:56 deraadt Exp $"); | 26 | RCSID("$OpenBSD: sftp-glob.c,v 1.10 2002/02/13 00:59:23 djm Exp $"); |
27 | 27 | ||
28 | #include "buffer.h" | 28 | #include "buffer.h" |
29 | #include "bufaux.h" | 29 | #include "bufaux.h" |
@@ -41,8 +41,7 @@ struct SFTP_OPENDIR { | |||
41 | }; | 41 | }; |
42 | 42 | ||
43 | static struct { | 43 | static struct { |
44 | int fd_in; | 44 | struct sftp_conn *conn; |
45 | int fd_out; | ||
46 | } cur; | 45 | } cur; |
47 | 46 | ||
48 | static void * | 47 | static void * |
@@ -52,7 +51,7 @@ fudge_opendir(const char *path) | |||
52 | 51 | ||
53 | r = xmalloc(sizeof(*r)); | 52 | r = xmalloc(sizeof(*r)); |
54 | 53 | ||
55 | if (do_readdir(cur.fd_in, cur.fd_out, (char*)path, &r->dir)) | 54 | if (do_readdir(cur.conn, (char*)path, &r->dir)) |
56 | return(NULL); | 55 | return(NULL); |
57 | 56 | ||
58 | r->offset = 0; | 57 | r->offset = 0; |
@@ -130,7 +129,7 @@ fudge_lstat(const char *path, struct stat *st) | |||
130 | { | 129 | { |
131 | Attrib *a; | 130 | Attrib *a; |
132 | 131 | ||
133 | if (!(a = do_lstat(cur.fd_in, cur.fd_out, (char*)path, 0))) | 132 | if (!(a = do_lstat(cur.conn, (char*)path, 0))) |
134 | return(-1); | 133 | return(-1); |
135 | 134 | ||
136 | attrib_to_stat(a, st); | 135 | attrib_to_stat(a, st); |
@@ -143,7 +142,7 @@ fudge_stat(const char *path, struct stat *st) | |||
143 | { | 142 | { |
144 | Attrib *a; | 143 | Attrib *a; |
145 | 144 | ||
146 | if (!(a = do_stat(cur.fd_in, cur.fd_out, (char*)path, 0))) | 145 | if (!(a = do_stat(cur.conn, (char*)path, 0))) |
147 | return(-1); | 146 | return(-1); |
148 | 147 | ||
149 | attrib_to_stat(a, st); | 148 | attrib_to_stat(a, st); |
@@ -152,7 +151,7 @@ fudge_stat(const char *path, struct stat *st) | |||
152 | } | 151 | } |
153 | 152 | ||
154 | int | 153 | int |
155 | remote_glob(int fd_in, int fd_out, const char *pattern, int flags, | 154 | remote_glob(struct sftp_conn *conn, const char *pattern, int flags, |
156 | int (*errfunc)(const char *, int), glob_t *pglob) | 155 | int (*errfunc)(const char *, int), glob_t *pglob) |
157 | { | 156 | { |
158 | pglob->gl_opendir = fudge_opendir; | 157 | pglob->gl_opendir = fudge_opendir; |
@@ -162,9 +161,7 @@ remote_glob(int fd_in, int fd_out, const char *pattern, int flags, | |||
162 | pglob->gl_stat = fudge_stat; | 161 | pglob->gl_stat = fudge_stat; |
163 | 162 | ||
164 | memset(&cur, 0, sizeof(cur)); | 163 | memset(&cur, 0, sizeof(cur)); |
165 | cur.fd_in = fd_in; | 164 | cur.conn = conn; |
166 | cur.fd_out = fd_out; | ||
167 | 165 | ||
168 | return(glob(pattern, flags | GLOB_ALTDIRFUNC, errfunc, | 166 | return(glob(pattern, flags | GLOB_ALTDIRFUNC, errfunc, pglob)); |
169 | pglob)); | ||
170 | } | 167 | } |