search for: send_status

Displaying 20 results from an estimated 40 matches for "send_status".

2002 Nov 05
0
[PATCH] Add readonly mode to scp, sftp_server
...at Stat; *************** *** 390,395 **** --- 393,404 ---- pflags = get_int(); /* portable flags */ a = get_attrib(); flags = flags_from_portable(pflags); + if (((flags & O_ACCMODE) == O_RDWR) || + ((flags & O_ACCMODE) == O_WRONLY)) { + status = SSH2_FX_PERMISSION_DENIED; + send_status(id, status); + return; + } mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a->perm : 0666; TRACE("open id %u name %s flags %d mode 0%o", id, name, pflags, mode); fd = open(name, flags, mode); *************** *** 587,592 **** --- 596,606 ---- id = get_int();...
2006 Mar 23
8
DRY principle - how to implement?
Hi all! I have ''send_status'' table which looks something like these: id code title 1 sent Sent 2 error Sending error 3 success Success Next I would like to associate some processed records with their ''send_status''. Is it better to use: 1) record.status_id = SendStatus.find(:one, :co...
2002 Mar 15
4
PATCH: sftp-server logging.
...2_FILEXFER_ATTR_ACMODTIME) { ret = utimes(name, attrib_to_tv(a)); ! if (ret == -1) status = errno_to_portable(errno); } if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { ret = chown(name, a->uid, a->gid); ! if (ret == -1) status = errno_to_portable(errno); } send_status(id, status); xfree(name); --- 662,708 ---- TRACE("setstat id %d name %s", id, name); if (a->flags & SSH2_FILEXFER_ATTR_SIZE) { ret = truncate(name, a->size); ! if (ret == -1) { status = errno_to_portable(errno); + #ifdef SFTP_LOGGING + log("(%d/%d/%s)...
2006 May 15
1
[PATCH 8/12] openssh-4.3p2 return code check bugs
...42:04.795120304 -0500 @@ -408,9 +408,12 @@ process_close(void) id = get_int(); handle = get_handle(); + if (handle < 0) + goto out; TRACE("close id %u handle %d", id, handle); ret = handle_close(handle); status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; +out: send_status(id, status); } @@ -424,6 +427,8 @@ process_read(void) id = get_int(); handle = get_handle(); + if (handle < 0) + goto out; off = get_int64(); len = get_int(); @@ -450,6 +455,7 @@ process_read(void) } } } +out: if (status != SSH2_FX_OK) send_status(id, status); } @@...
2007 Nov 11
1
ftp-server patch - restrict user to directory
...id, handle); - status = SSH2_FX_OK; + handle = handle_new(HANDLE_DIR, path, 0, dirp); + if (handle < 0) { + closedir(dirp); + } else { + send_handle(id, handle); + status = SSH2_FX_OK; + } } + } else + status = errno_to_portable(EPERM); - } if (status != SSH2_FX_OK) send_status(id, status); xfree(path); @@ -899,9 +1038,14 @@ id = get_int(); name = get_string(NULL); debug3("request %u: remove", id); - logit("remove name \"%s\"", name); - ret = unlink(name); - status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; + + if(allowed_...
2007 Dec 07
2
[PATCH] add statfs extension to sftp-server
..._symlink(void) } static void +process_extended_statfs(u_int32_t id) +{ + char *path; + struct statfs st; + int ret; + + path = get_string(NULL); + debug3("request %u: statfs", id); + logit("statfs \"%s\"", path); + + ret = statfs(path, &st); + if (ret == -1) + send_status(id, errno_to_portable(errno)); + else + send_statfs(id, &st); + xfree(path); +} + +static void process_extended(void) { u_int32_t id; @@ -1056,7 +1094,10 @@ process_extended(void) id = get_int(); request = get_string(NULL); - send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST *...
2014 Jan 01
0
Soft chroot jail for sftp-server
...(*(path+i) == '/') > *(path+i) = '\0'; > else break; > } > } > 523d650 < 552d678 < 554a681,696 > name = jail_to_actual(name); > if (jail != NULL) { > char resolvedname[MAXPATHLEN]; > if (realpath(name, resolvedname) == NULL) { > send_status(id, errno_to_portable(errno)); > free(name); > return; > } > char* jailed_resolvedname = actual_to_jail(xstrdup(resolvedname)); > if (jailed_resolvedname == NULL) { > send_status(id,SSH2_FX_FAILURE); > free(name); > return; > } > > } 589d7...
2006 Aug 17
0
[RFC] proposed extensions for SFTP
...9,24 @@ } static void +process_extended_statvfs(u_int32_t id) +{ + char *path; + struct statvfs st; + int ret; + + path = get_string(NULL); + debug3("request %u: statvfs", id); + verbose("statvfs \"%s\"", path); + + ret = statvfs(path, &st); + if (ret == -1) + send_status(id, errno_to_portable(errno)); + else + send_statvfs(id, &st); +} + +static void process_extended(void) { u_int32_t id; @@ -1056,7 +1104,10 @@ id = get_int(); request = get_string(NULL); - send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */ + if (strcmp(request, "statvfs at ope...
2006 Aug 19
0
[PATCH] add atomic rename extension to sftp-server
...d) +{ + char *oldpath, *newpath; + + oldpath = get_string(NULL); + newpath = get_string(NULL); + debug3("request %u: posix-rename", id); + logit("posix-rename old \"%s\" new \"%s\"", oldpath, newpath); + if (rename(oldpath, newpath) == -1) + send_status(id, errno_to_portable(errno)); + else + send_status(id, SSH2_FX_OK); + xfree(oldpath); + xfree(newpath); +} + +static void process_extended(void) { u_int32_t id; @@ -1096,6 +1113,8 @@ process_extended(void) request = get_string(NULL); if (strcmp(request, "statfs at op...
2006 Aug 19
0
[PATCH] add statfs extension to sftp-server
..._symlink(void) } static void +process_extended_statfs(u_int32_t id) +{ + char *path; + struct statfs st; + int ret; + + path = get_string(NULL); + debug3("request %u: statfs", id); + logit("statfs \"%s\"", path); + + ret = statfs(path, &st); + if (ret == -1) + send_status(id, errno_to_portable(errno)); + else + send_statfs(id, &st); + xfree(path); +} + +static void process_extended(void) { u_int32_t id; @@ -1056,7 +1094,10 @@ process_extended(void) id = get_int(); request = get_string(NULL); - send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST *...
2001 May 24
1
chroot sftp-server [PATCH]
I'm working on setting up a semi-trusted sftp service, and to get it working, I need chroot capability. I've taken the /./ wuftpd magic token code from contrib/chroot.diff and put it into the sftp server. The main problem is that privileges have been dropped by the time the subsystem is exec'ed, so my patch requires that sftp-server be setuid root. Not ideal, I know, but I drop all
2002 Nov 05
0
[PATCH] Add getlink command to sftp
...tus = errno_to_portable(errno); } --- 618,624 ---- status = errno_to_portable(errno); } if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { ! ret = lchown(name, a->uid, a->gid); if (ret == -1) status = errno_to_portable(errno); } *************** *** 907,915 **** send_status(id, errno_to_portable(errno)); else { Stat s; ! link[len] = '\0'; attrib_clear(&s.attrib); s.name = s.long_name = link; send_names(id, 1, &s); } --- 941,958 ---- send_status(id, errno_to_portable(errno)); else { Stat s; ! struct stat st; ! i...
2009 Feb 12
2
[patch] hard link protocol extension for sftp
...+process_extended_link(u_int32_t id) +{ + char *oldpath, *newpath; + + oldpath = get_string(NULL); + newpath = get_string(NULL); + debug3("request %u: link", id); + logit("link old \"%s\" new \"%s\"", oldpath, newpath); + if (link(oldpath, newpath) == -1) + send_status(id, errno_to_portable(errno)); + else + send_status(id, SSH2_FX_OK); + xfree(oldpath); + xfree(newpath); +} + +static void process_extended(void) { u_int32_t id; @@ -1166,6 +1186,8 @@ process_extended(void) process_extended_statvfs(id); else if (strcmp(request, "fstatvfs at openssh.c...
2001 Jun 20
1
SFTP Logging Redux.
...FAILURE; } else { @@ -790,6 +823,7 @@ id = get_int(); name = get_string(NULL); TRACE("remove id %d name %s", id, name); + log("(%d/%d/%s) File deleted: %s", ppid, cuid, CUNAME, name); ret = unlink(name); status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; send_status(id, status); @@ -810,6 +844,7 @@ mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a->perm & 0777 : 0777; TRACE("mkdir id %d name %s mode 0%o", id, name, mode); + log("(%d/%d/%s) Directory created: %s", ppid, cuid, CUNAME, name); ret = mkdir(name, mo...
2003 Feb 05
2
Minor races in sftp-server.c
...; - status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; - } + if (link(oldpath, newpath) == -1) + status = errno_to_portable(errno); + else if (unlink(oldpath) == -1) { + status = errno_to_portable(errno); + /* clean spare link */ + unlink(newpath); + } else + status = SSH2_FX_OK; send_status(id, status); xfree(oldpath); xfree(newpath); @@ -878,19 +881,16 @@ process_symlink(void) { u_int32_t id; - struct stat st; char *oldpath, *newpath; - int ret, status = SSH2_FX_FAILURE; + int ret, status; id = get_int(); oldpath = get_string(NULL); newpath = get_string(NULL); TRA...
2012 Oct 23
4
Disable rm on sftp
...FAILURE; int ret; id = get_int(); name = get_string(NULL); debug3("request %u: remove", id); logit("remove name \"%s\"", name); if (readonly) status = SSH2_FX_PERMISSION_DENIED; else { ret = unlink(name); status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; } send_status(id, status); xfree(name); } To : static void process_remove(void) { char *name; u_int32_t id; int status = SSH2_FX_FAILURE; int ret; id = get_int(); name = get_string(NULL); debug3("request %u: remove", id); logit("remove name \"%s\"", name); status = SSH2_FX_PERMI...
2001 Feb 21
1
sftp-server and chown
...<appro at fy.chalmers.se> + */ if (a->flags & SSH2_FILEXFER_ATTR_UIDGID) { ret = chown(name, a->uid, a->gid); if (ret == -1) status = errno_to_portable(errno); } + #endif send_status(id, status); xfree(name); } *************** *** 591,600 **** status = SSH2_FX_FAILURE; } else { if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { #ifdef HAVE_FCHMOD ! ret = fchmod(fd, a->perm & 0777); #else !...
2015 Mar 24
2
[virtio-dev] Re: [PATCH v3] Add virtio-input driver.
...> + le16_to_cpu(event->code), > > + le32_to_cpu(event->value)); > > What happens if input layer gets an > unexpected event code or value? input layer checks it and ignores events not supported (according to the support bitmaps). > > +static int virtinput_send_status(struct virtio_input *vi, > > + u16 type, u16 code, s32 value) > > +{ > This means that caller will get errors if it happens to call > send_status at a rate that's faster than host's consumption of them. > To me this looks wrong. > Poking at input layer, it seems...
2015 Mar 24
2
[virtio-dev] Re: [PATCH v3] Add virtio-input driver.
...> + le16_to_cpu(event->code), > > + le32_to_cpu(event->value)); > > What happens if input layer gets an > unexpected event code or value? input layer checks it and ignores events not supported (according to the support bitmaps). > > +static int virtinput_send_status(struct virtio_input *vi, > > + u16 type, u16 code, s32 value) > > +{ > This means that caller will get errors if it happens to call > send_status at a rate that's faster than host's consumption of them. > To me this looks wrong. > Poking at input layer, it seems...
2004 Oct 25
1
Bug in sftp's chmod
Hi, I've discovered that on OpenSSH_3.6.1p1 (the latest SSH available on OSX, but I've also tried a couple of different linux distributions), when you 'sftp' to it, and try to 'chmod' some file or directory, only last three octal digits do actually matter. Example: sftp sshtest at localhost Connecting to localhost... sshtest at localhost's password: sftp> ls -l