search for: buffer_get_int

Displaying 20 results from an estimated 34 matches for "buffer_get_int".

2009 Feb 12
2
[patch 1/3] add protocol extension to ATTR message
...V) + st->st_rdev = a->rdev; + if (a->ext_flags & SSH2_FXE_EXTATTR_BLKSIZE) + st->st_blksize = a->blksize; + if (a->ext_flags & SSH2_FXE_EXTATTR_BLOCKS) + st->st_blocks = a->blocks; +} + +static void +decode_extra_attrib(Buffer *b, Attrib *a) +{ + a->ext_flags = buffer_get_int(b); + if (a->ext_flags & SSH2_FXE_EXTATTR_DEV) + a->dev = buffer_get_int64(b); + if (a->ext_flags & SSH2_FXE_EXTATTR_INO) + a->ino = buffer_get_int64(b); + if (a->ext_flags & SSH2_FXE_EXTATTR_NLINK) + a->nlink = buffer_get_int(b); + if (a->ext_flags & SSH2_FX...
2006 May 04
2
xmalloc(foo*bar) -> xcalloc(foo, bar) for Portable
.../security/openssh/cvs/openssh_cvs/auth-pam.c,v retrieving revision 1.132 diff -u -p -r1.132 auth-pam.c --- auth-pam.c 26 Mar 2006 03:22:48 -0000 1.132 +++ auth-pam.c 4 May 2006 01:51:57 -0000 @@ -288,7 +288,7 @@ import_environments(Buffer *b) /* Import environment from subprocess */ num_env = buffer_get_int(b); - sshpam_env = xmalloc((num_env + 1) * sizeof(*sshpam_env)); + sshpam_env = xcalloc(num_env + 1, sizeof(*sshpam_env)); debug3("PAM: num env strings %d", num_env); for(i = 0; i < num_env; i++) sshpam_env[i] = buffer_get_string(b, NULL); Index: groupaccess.c ==================...
2003 Dec 07
0
[PATCH] Do PAM chauthtok via keyboard-interactive.
...11_forwarding_flag &= ~2; + + } +} /* Import regular and PAM environment from subprocess */ static void import_environments(Buffer *b) @@ -152,6 +169,13 @@ import_environments(Buffer *b) u_int i, num_env; int err; + /* Import variables set by do_pam_account */ + sshpam_account_status = buffer_get_int(b); + sshpam_new_authtok_reqd = buffer_get_int(b); + + if (sshpam_new_authtok_reqd == 1) + pam_password_change_required(1); + /* Import environment from subprocess */ num_env = buffer_get_int(b); sshpam_env = xmalloc((num_env + 1) * sizeof(*sshpam_env)); @@ -290,9 +314,28 @@ sshpam_thread(vo...
2002 Apr 21
3
OpenSSH Security Advisory (adv.token)
...(bin, len, value); xfree(bin); } - /* - * Returns an integer from the buffer (4 bytes, msb first). + * Returns integers from the buffer (msb first). */ + +u_short +buffer_get_short(Buffer *buffer) +{ + u_char buf[2]; + buffer_get(buffer, (char *) buf, 2); + return GET_16BIT(buf); +} + u_int buffer_get_int(Buffer *buffer) { @@ -158,8 +166,16 @@ } /* - * Stores an integer in the buffer in 4 bytes, msb first. + * Stores integers in the buffer, msb first. */ +void +buffer_put_short(Buffer *buffer, u_short value) +{ + char buf[2]; + PUT_16BIT(buf, value); + buffer_append(buffer, buf, 2); +} + void...
2002 Apr 21
3
OpenSSH Security Advisory (adv.token)
...(bin, len, value); xfree(bin); } - /* - * Returns an integer from the buffer (4 bytes, msb first). + * Returns integers from the buffer (msb first). */ + +u_short +buffer_get_short(Buffer *buffer) +{ + u_char buf[2]; + buffer_get(buffer, (char *) buf, 2); + return GET_16BIT(buf); +} + u_int buffer_get_int(Buffer *buffer) { @@ -158,8 +166,16 @@ } /* - * Stores an integer in the buffer in 4 bytes, msb first. + * Stores integers in the buffer, msb first. */ +void +buffer_put_short(Buffer *buffer, u_short value) +{ + char buf[2]; + PUT_16BIT(buf, value); + buffer_append(buffer, buf, 2); +} + void...
2005 May 19
1
ssh-keygen private keys export - new feature
...xfree(blob); exit(0); @@ -216,7 +326,6 @@ u_char *sig, data[] = "abcde12345"; int magic, rlen, ktype, i1, i2, i3, i4; u_int slen; - u_long e; buffer_init(&b); buffer_append(&b, blob, blen); @@ -232,8 +341,7 @@ cipher = buffer_get_string(&b, NULL); i2 = buffer_get_int(&b); i3 = buffer_get_int(&b); - i4 = buffer_get_int(&b); - debug("ignore (%d %d %d %d)", i1,i2,i3,i4); + debug("ignore (%d %d %d)", i1,i2,i3); if (strcmp(cipher, "none") != 0) { error("unsupported cipher %s", cipher); xfree(cipher);...
2004 Feb 27
1
Minor Thread Bug In OpenSSH 3.8p1
...c *** old/auth-pam.c Tue Feb 17 05:20:08 2004 --- new/auth-pam.c Thu Feb 26 23:18:05 2004 *************** *** 201,206 **** --- 201,207 ---- debug3("PAM: %s entering", __func__); + #ifndef USE_POSIX_THREADS /* Import variables set by do_pam_account */ sshpam_account_status = buffer_get_int(b); pam_password_change_required(buffer_get_int(b)); *************** *** 228,233 **** --- 229,235 ---- } #endif } + #endif } /* ----------------------------------------------------------------------- Antoine Verheijen Email: antoine.verheijen at ualberta.ca CNS...
2008 Jun 19
5
Portforwarding using the control master.
Hi all, currently I am considering writing a patch for OpenSSH that will allow portforwarding using the control_master unix domain socket. The idea is to introduce an extra SSHMUX command, SSHMUX_COMMAND_SOCKS, which will then pass control to the normal socks functions used for dynamic forwarding. The main reason for me to write this patch are: - some more control over who gets to connect to
2010 Jan 14
1
ssh(1) multiplexing rewrite
...nc__); - close(client_fd); - buffer_free(&m); - return 0; - } - if ((ver = buffer_get_char(&m)) != SSHMUX_VER) { - error("%s: wrong client version %d", __func__, ver); - buffer_free(&m); - close(client_fd); - return 0; - } + return 0; +} - allowed = 1; - mux_command = buffer_get_int(&m); - flags = buffer_get_int(&m); +/* Mux master protocol message handlers */ - buffer_clear(&m); +static int +process_mux_master_hello(struct mux_master_state *state, Channel *c, + Buffer *m, Buffer *r) +{ + u_int ver; - switch (mux_command) { - case SSHMUX_COMMAND_OPEN: - if...
2007 Jan 08
0
How to remove group1 and group14 from OpenSSH..
...= 0) { k->kex_type = KEX_DH_GEX_SHA1; k->evp_md = EVP_sha1(); } else if (strcmp(k->name, KEX_DHGEX_SHA256) == 0) { k->kex_type = KEX_DH_GEX_SHA256; k->evp_md = evp_ssh_sha256(); } else fatal("bad kex alg %s", k->name); } IN monitor.c kex->we_need = buffer_get_int(m); kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; kex->kex[KEX_DH_GEX_SHA256] = kexgex_server; kex->server = 1; CHANGE TO kex->we_need = buffer_get_int(m); kex->kex[KEX_DH_GEX_SHA1] = kexgex_s...
2003 Oct 08
4
OS/390 openssh
...212,36 @@ * will be stored there. A null character will be automatically appended * to the returned string, and is not counted in length. */ +#ifdef CHARSET_EBCDIC +void * +buffer_get_binary(Buffer *buffer, u_int *length_ptr) +{ + u_char *value; + u_int len; + + /* Get the length. */ + len = buffer_get_int(buffer); + if (len > 256 * 1024) + fatal("buffer_get_binary: bad length %d", len); + /* Allocate space for the object. Add one byte for a null character. */ + value = xmalloc(len + 1); + /* Get the string. */ + buffer_get(buffer, value, len); + /* Append a null character to make proc...
2012 Jan 28
1
PATCH: Support for encrypted host keys
..._key_rsa(buffer, key->rsa); + break; + case KEY_DSA: + buffer_put_key_dsa(buffer, key->dsa); + break; + default: + fatal("%s: unsupported key type (%s)", __func__, + key_type(key)); + } +} + +Key * +buffer_get_key(Buffer *buffer) +{ + Key *key; + int type, flags; + + type = buffer_get_int(buffer); + flags = buffer_get_int(buffer); + + key = key_new_private(type); + key->flags = flags; + + switch (type) { + case KEY_RSA1: + case KEY_RSA: + buffer_get_key_rsa(buffer, key->rsa); + break; + case KEY_DSA: + buffer_get_key_dsa(buffer, key->dsa); + break; + default: + fatal(&...
2000 Sep 18
1
ssh-agent and ssh2 servers...
I'm not on the mailing list, so I'd appreciate it if you could cc: me, though I will keep an eye on the archives. I am running openssh 2.2.0p1 on Debian GNU/Linux. I was pleased to see that 2.2.0p1 had support for DSA keys in the agent, and I have successfully used the v2 protocol to another openssh server with the agent providing authentication. I am also able to successfully connect
2002 Jan 03
3
[PATCH] Improving sftp client performance
...IZE; + req[num_req].offset = offset; + offset += req[num_req].len; + num_req++; + send_request(fd_out, handle, handle_len, SSH2_FXP_READ, + &req[num_req - 1], &msg); + } buffer_clear(&msg); - get_msg(fd_in, &msg); type = buffer_get_char(&msg); id = buffer_get_int(&msg); debug3("Received reply T:%d I:%d", type, id); - if (id != expected_id) - fatal("ID mismatch (%d != %d)", id, expected_id); - if (type == SSH2_FXP_STATUS) { + reply = find_request(req, num_req, id); + + switch (type) { + case SSH2_FXP_STATUS: status = buf...
2001 Dec 18
1
chroot howto for sftp-server
...r to use a dummy shell. 5 The Patch: ============ (diff against 3.0.1) --- sftp-server.c Tue Jul 31 14:42:50 2001 +++ sftp-server.c~ Fri Nov 23 10:56:48 2001 @@ -33,6 +33,8 @@ #include "sftp.h" #include "sftp-common.h" +#define CHROOT + /* helper */ #define get_int64() buffer_get_int64(&iqueue); #define get_int() buffer_get_int(&iqueue); @@ -1008,6 +1010,36 @@ } } +#ifdef CHROOT +void +chroot_init(void) +{ + char *user_dir, *new_root; + + user_dir = getenv("HOME"); + + if (!user_dir) + fatal("HOME isn't in environment"); + + new_root = u...
2003 Aug 16
0
sftp-server (secure) chroot patch, comment fix
...quot;sftp.h" #include "sftp-common.h" +#ifdef CHROOT +#include "uidswap.h" +#include <pwd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <string.h> +#include <unistd.h> +#endif /* CHROOT */ + /* helper */ #define get_int64() buffer_get_int64(&iqueue); #define get_int() buffer_get_int(&iqueue); @@ -62,6 +71,51 @@ Attrib attrib; }; +#ifdef CHROOT +static void +chroot_init(void) +{ + gid_t gidset[1]; + struct passwd *pw; + struct stat st; + + /* Sanity checking before chroot */ + if ((pw = getpwuid(getuid())) == NULL) +...
2004 Dec 17
0
ssh-keysign bug?
...ng with the error "bad fd". A little exploring showed that this was happening because in the batch environment the ssh command did not have a STDIN opened and the socket used for IPC was being created as fd 0. You can see the difference here from a ls -l of /proc/pid/fd right after buffer_get_int(&b) is called in ssh-keysign's main(): --- Normal SSH: 0 -> /dev/pts/3 1 -> /dev/pts/3 2 -> /dev/pts/3 3 -> socket:[37629928] 5 -> pipe:[37629941] 6 -> pipe:[37629942] --- Normal SSH-KEYSIGN: 0 -> pipe:[37629941] 1 -> pipe:[37629942] 2 -> /dev/pts/3 3 -> so...
2009 Dec 18
0
[agc@NetBSD.org: CVS commit: src/crypto/external/bsd/openssh/dist]
...pes.h> #include <sys/time.h> #include <sys/queue.h> @@ -307,13 +307,13 @@ Buffer msg; Key *key; + odatafellows = datafellows; datafellows = 0; blob = buffer_get_string(&e->request, &blen); data = buffer_get_string(&e->request, &dlen); flags = buffer_get_int(&e->request); - odatafellows = datafellows; if (flags & SSH_AGENT_OLD_SIGNATURE) datafellows = SSH_BUG_SIGBLOB;
2011 Jun 02
2
preauth privsep logging via monitor
...p;logmsg)) != buffer_len(&logmsg)) { + if (errno == EPIPE) { + debug("%s: child log fd closed", __func__); + close(pmonitor->m_log_recvfd); + pmonitor->m_log_recvfd = -1; + return -1; + } + fatal("%s: log fd read: %s", __func__, strerror(errno)); + } + len = buffer_get_int(&logmsg); + if (len <= 4 || len > 8192) + fatal("%s: invalid log message length %u", __func__, len); + buffer_clear(&logmsg); + buffer_append_space(&logmsg, len); + if (atomicio(read, pmonitor->m_log_recvfd, + buffer_ptr(&logmsg), buffer_len(&logmsg)) !=...
2003 Sep 30
1
[PATCH] sftp-server (secure) chroot patch, 3.7.1p2 update
...sftp.h\" #include \"sftp-common.h\" +#ifdef CHROOT +#include \"uidswap.h\" +#include <pwd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <string.h> +#include <unistd.h> +#endif /* CHROOT */ + /* helper */ #define get_int64() buffer_get_int64(&iqueue); #define get_int() buffer_get_int(&iqueue); @@ -62,6 +72,49 @@ Attrib attrib; }; +#ifdef CHROOT +static void +chroot_init(void) +{ + struct passwd *pw; + struct stat st; + + /* Sanity checking before chroot */ + if ((pw = getpwuid(getuid())) == NULL) + fatal(\"getpw...