* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Markus Friedl.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: sftp-server.c,v 1.4 2000/09/04 19:10:08 markus Exp $");
+RCSID("$OpenBSD: sftp-server.c,v 1.6 2000/09/07 20:27:53 deraadt Exp $");
#include "ssh.h"
#include "buffer.h"
{
static Attrib a;
attrib_clear(&a);
- a.flags = get_int();
+ a.flags = buffer_get_int(b);
if (a.flags & SSH_FXA_HAVE_SIZE) {
- a.size_high = get_int();
- a.size_low = get_int();
+ a.size_high = buffer_get_int(b);
+ a.size_low = buffer_get_int(b);
a.size = (((u_int64_t) a.size_high) << 32) + a.size_low;
}
if (a.flags & SSH_FXA_HAVE_UGID) {
- a.uid = get_int();
- a.gid = get_int();
+ a.uid = buffer_get_int(b);
+ a.gid = buffer_get_int(b);
}
if (a.flags & SSH_FXA_HAVE_PERM) {
- a.perm = get_int();
+ a.perm = buffer_get_int(b);
}
if (a.flags & SSH_FXA_HAVE_TIME) {
- a.atime = get_int();
- a.mtime = get_int();
+ a.atime = buffer_get_int(b);
+ a.mtime = buffer_get_int(b);
}
return &a;
}
}
int
-handle_from_string(char *handle, int hlen)
+handle_from_string(char *handle, u_int hlen)
{
/* XXX OVERFLOW ? */
char *ep;
get_handle(void)
{
char *handle;
- int hlen, val;
+ int val;
+ u_int hlen;
handle = get_string(&hlen);
val = handle_from_string(handle, hlen);
xfree(handle);
len = get_int();
off = (((u_int64_t) off_high) << 32) + off_low;
- TRACE("read id %d handle %d off %qd len %d", id, handle, off, len);
+ TRACE("read id %d handle %d off %lld len %d", id, handle, off, len);
if (len > sizeof buf) {
len = sizeof buf;
log("read change len %d", len);
{
u_int32_t id, off_high, off_low;
u_int64_t off;
- int len;
+ u_int len;
int handle, fd, ret, status = SSH_FX_FAILURE;
char *data;
data = get_string(&len);
off = (((u_int64_t) off_high) << 32) + off_low;
- TRACE("write id %d handle %d off %qd len %d", id, handle, off, len);
+ TRACE("write id %d handle %d off %lld len %d", id, handle, off, len);
fd = handle_to_fd(handle);
if (fd >= 0) {
if (lseek(fd, off, SEEK_SET) < 0) {
u_int32_t id;
int handle, fd, ret;
int status = SSH_FX_OK;
- char *name = NULL;
-
+ char *name;
+
id = get_int();
handle = get_handle();
a = get_attrib();
ls_file(char *name, struct stat *st)
{
char buf[1024];
- snprintf(buf, sizeof buf, "0%o %d %d %qd %d %s",
+ snprintf(buf, sizeof buf, "0%o %d %d %lld %d %s",
st->st_mode, st->st_uid, st->st_gid, (long long)st->st_size,(int) st->st_mtime,
name);
return xstrdup(buf);
{
fd_set rset, wset;
int in, out, max;
- size_t len, olen;
+ ssize_t len, olen;
handle_init();