Browse Source

Remove prop229 stuff from socks5.trunnel

rl1987 5 years ago
parent
commit
f27dc41627
3 changed files with 206 additions and 1831 deletions
  1. 206 1433
      src/trunnel/socks5.c
  2. 0 376
      src/trunnel/socks5.h
  3. 0 22
      src/trunnel/socks5.trunnel

File diff suppressed because it is too large
+ 206 - 1433
src/trunnel/socks5.c


+ 0 - 376
src/trunnel/socks5.h

@@ -82,16 +82,6 @@ struct socks5_server_userpass_auth_st {
 };
 #endif
 typedef struct socks5_server_userpass_auth_st socks5_server_userpass_auth_t;
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TOR_SOCKSAUTH_KEYVAL)
-struct tor_socksauth_keyval_st {
-  uint16_t keylen;
-  trunnel_string_t key;
-  uint16_t vallen;
-  trunnel_string_t val;
-  uint8_t trunnel_error_code_;
-};
-#endif
-typedef struct tor_socksauth_keyval_st tor_socksauth_keyval_t;
 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_SOCKS5_CLIENT_REQUEST)
 struct socks5_client_request_st {
   uint8_t version;
@@ -120,25 +110,6 @@ struct socks5_server_reply_st {
 };
 #endif
 typedef struct socks5_server_reply_st socks5_server_reply_t;
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TOR_EXTENDED_SOCKS_AUTH_REQUEST)
-struct tor_extended_socks_auth_request_st {
-  uint8_t version;
-  uint16_t npairs;
-  TRUNNEL_DYNARRAY_HEAD(, struct tor_socksauth_keyval_st *) pairs;
-  uint8_t trunnel_error_code_;
-};
-#endif
-typedef struct tor_extended_socks_auth_request_st tor_extended_socks_auth_request_t;
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TOR_EXTENDED_SOCKS_AUTH_RESPONSE)
-struct tor_extended_socks_auth_response_st {
-  uint8_t version;
-  uint8_t status;
-  uint16_t npairs;
-  TRUNNEL_DYNARRAY_HEAD(, struct tor_socksauth_keyval_st *) pairs;
-  uint8_t trunnel_error_code_;
-};
-#endif
-typedef struct tor_extended_socks_auth_response_st tor_extended_socks_auth_response_t;
 /** Return a newly allocated domainname with all elements set to zero.
  */
 domainname_t *domainname_new(void);
@@ -753,154 +724,6 @@ uint8_t socks5_server_userpass_auth_get_status(const socks5_server_userpass_auth
  * success; return -1 and set the error code on 'inp' on failure.
  */
 int socks5_server_userpass_auth_set_status(socks5_server_userpass_auth_t *inp, uint8_t val);
-/** Return a newly allocated tor_socksauth_keyval with all elements
- * set to zero.
- */
-tor_socksauth_keyval_t *tor_socksauth_keyval_new(void);
-/** Release all storage held by the tor_socksauth_keyval in 'victim'.
- * (Do nothing if 'victim' is NULL.)
- */
-void tor_socksauth_keyval_free(tor_socksauth_keyval_t *victim);
-/** Try to parse a tor_socksauth_keyval from the buffer in 'input',
- * using up to 'len_in' bytes from the input buffer. On success,
- * return the number of bytes consumed and set *output to the newly
- * allocated tor_socksauth_keyval_t. On failure, return -2 if the
- * input appears truncated, and -1 if the input is otherwise invalid.
- */
-ssize_t tor_socksauth_keyval_parse(tor_socksauth_keyval_t **output, const uint8_t *input, const size_t len_in);
-/** Return the number of bytes we expect to need to encode the
- * tor_socksauth_keyval in 'obj'. On failure, return a negative value.
- * Note that this value may be an overestimate, and can even be an
- * underestimate for certain unencodeable objects.
- */
-ssize_t tor_socksauth_keyval_encoded_len(const tor_socksauth_keyval_t *obj);
-/** Try to encode the tor_socksauth_keyval from 'input' into the
- * buffer at 'output', using up to 'avail' bytes of the output buffer.
- * On success, return the number of bytes used. On failure, return -2
- * if the buffer was not long enough, and -1 if the input was invalid.
- */
-ssize_t tor_socksauth_keyval_encode(uint8_t *output, size_t avail, const tor_socksauth_keyval_t *input);
-/** Check whether the internal state of the tor_socksauth_keyval in
- * 'obj' is consistent. Return NULL if it is, and a short message if
- * it is not.
- */
-const char *tor_socksauth_keyval_check(const tor_socksauth_keyval_t *obj);
-/** Clear any errors that were set on the object 'obj' by its setter
- * functions. Return true iff errors were cleared.
- */
-int tor_socksauth_keyval_clear_errors(tor_socksauth_keyval_t *obj);
-/** Return the value of the keylen field of the tor_socksauth_keyval_t
- * in 'inp'
- */
-uint16_t tor_socksauth_keyval_get_keylen(const tor_socksauth_keyval_t *inp);
-/** Set the value of the keylen field of the tor_socksauth_keyval_t in
- * 'inp' to 'val'. Return 0 on success; return -1 and set the error
- * code on 'inp' on failure.
- */
-int tor_socksauth_keyval_set_keylen(tor_socksauth_keyval_t *inp, uint16_t val);
-/** Return the length of the dynamic array holding the key field of
- * the tor_socksauth_keyval_t in 'inp'.
- */
-size_t tor_socksauth_keyval_getlen_key(const tor_socksauth_keyval_t *inp);
-/** Return the element at position 'idx' of the dynamic array field
- * key of the tor_socksauth_keyval_t in 'inp'.
- */
-char tor_socksauth_keyval_get_key(tor_socksauth_keyval_t *inp, size_t idx);
-/** As tor_socksauth_keyval_get_key, but take and return a const
- * pointer
- */
-char tor_socksauth_keyval_getconst_key(const tor_socksauth_keyval_t *inp, size_t idx);
-/** Change the element at position 'idx' of the dynamic array field
- * key of the tor_socksauth_keyval_t in 'inp', so that it will hold
- * the value 'elt'.
- */
-int tor_socksauth_keyval_set_key(tor_socksauth_keyval_t *inp, size_t idx, char elt);
-/** Append a new element 'elt' to the dynamic array field key of the
- * tor_socksauth_keyval_t in 'inp'.
- */
-int tor_socksauth_keyval_add_key(tor_socksauth_keyval_t *inp, char elt);
-/** Return a pointer to the variable-length array field key of 'inp'.
- */
-char * tor_socksauth_keyval_getarray_key(tor_socksauth_keyval_t *inp);
-/** As tor_socksauth_keyval_get_key, but take and return a const
- * pointer
- */
-const char  * tor_socksauth_keyval_getconstarray_key(const tor_socksauth_keyval_t *inp);
-/** Change the length of the variable-length array field key of 'inp'
- * to 'newlen'.Fill extra elements with 0. Return 0 on success; return
- * -1 and set the error code on 'inp' on failure.
- */
-int tor_socksauth_keyval_setlen_key(tor_socksauth_keyval_t *inp, size_t newlen);
-/** Return the value of the key field of a tor_socksauth_keyval_t as a
- * NUL-terminated string.
- */
-const char * tor_socksauth_keyval_getstr_key(tor_socksauth_keyval_t *inp);
-/** Set the value of the key field of a tor_socksauth_keyval_t to a
- * given string of length 'len'. Return 0 on success; return -1 and
- * set the error code on 'inp' on failure.
- */
-int tor_socksauth_keyval_setstr0_key(tor_socksauth_keyval_t *inp, const char *val, size_t len);
-/** Set the value of the key field of a tor_socksauth_keyval_t to a
- * given NUL-terminated string. Return 0 on success; return -1 and set
- * the error code on 'inp' on failure.
- */
-int tor_socksauth_keyval_setstr_key(tor_socksauth_keyval_t *inp, const char *val);
-/** Return the value of the vallen field of the tor_socksauth_keyval_t
- * in 'inp'
- */
-uint16_t tor_socksauth_keyval_get_vallen(const tor_socksauth_keyval_t *inp);
-/** Set the value of the vallen field of the tor_socksauth_keyval_t in
- * 'inp' to 'val'. Return 0 on success; return -1 and set the error
- * code on 'inp' on failure.
- */
-int tor_socksauth_keyval_set_vallen(tor_socksauth_keyval_t *inp, uint16_t val);
-/** Return the length of the dynamic array holding the val field of
- * the tor_socksauth_keyval_t in 'inp'.
- */
-size_t tor_socksauth_keyval_getlen_val(const tor_socksauth_keyval_t *inp);
-/** Return the element at position 'idx' of the dynamic array field
- * val of the tor_socksauth_keyval_t in 'inp'.
- */
-char tor_socksauth_keyval_get_val(tor_socksauth_keyval_t *inp, size_t idx);
-/** As tor_socksauth_keyval_get_val, but take and return a const
- * pointer
- */
-char tor_socksauth_keyval_getconst_val(const tor_socksauth_keyval_t *inp, size_t idx);
-/** Change the element at position 'idx' of the dynamic array field
- * val of the tor_socksauth_keyval_t in 'inp', so that it will hold
- * the value 'elt'.
- */
-int tor_socksauth_keyval_set_val(tor_socksauth_keyval_t *inp, size_t idx, char elt);
-/** Append a new element 'elt' to the dynamic array field val of the
- * tor_socksauth_keyval_t in 'inp'.
- */
-int tor_socksauth_keyval_add_val(tor_socksauth_keyval_t *inp, char elt);
-/** Return a pointer to the variable-length array field val of 'inp'.
- */
-char * tor_socksauth_keyval_getarray_val(tor_socksauth_keyval_t *inp);
-/** As tor_socksauth_keyval_get_val, but take and return a const
- * pointer
- */
-const char  * tor_socksauth_keyval_getconstarray_val(const tor_socksauth_keyval_t *inp);
-/** Change the length of the variable-length array field val of 'inp'
- * to 'newlen'.Fill extra elements with 0. Return 0 on success; return
- * -1 and set the error code on 'inp' on failure.
- */
-int tor_socksauth_keyval_setlen_val(tor_socksauth_keyval_t *inp, size_t newlen);
-/** Return the value of the val field of a tor_socksauth_keyval_t as a
- * NUL-terminated string.
- */
-const char * tor_socksauth_keyval_getstr_val(tor_socksauth_keyval_t *inp);
-/** Set the value of the val field of a tor_socksauth_keyval_t to a
- * given string of length 'len'. Return 0 on success; return -1 and
- * set the error code on 'inp' on failure.
- */
-int tor_socksauth_keyval_setstr0_val(tor_socksauth_keyval_t *inp, const char *val, size_t len);
-/** Set the value of the val field of a tor_socksauth_keyval_t to a
- * given NUL-terminated string. Return 0 on success; return -1 and set
- * the error code on 'inp' on failure.
- */
-int tor_socksauth_keyval_setstr_val(tor_socksauth_keyval_t *inp, const char *val);
 /** Return a newly allocated socks5_client_request with all elements
  * set to zero.
  */
@@ -1167,205 +990,6 @@ uint16_t socks5_server_reply_get_bind_port(const socks5_server_reply_t *inp);
  * code on 'inp' on failure.
  */
 int socks5_server_reply_set_bind_port(socks5_server_reply_t *inp, uint16_t val);
-/** Return a newly allocated tor_extended_socks_auth_request with all
- * elements set to zero.
- */
-tor_extended_socks_auth_request_t *tor_extended_socks_auth_request_new(void);
-/** Release all storage held by the tor_extended_socks_auth_request in
- * 'victim'. (Do nothing if 'victim' is NULL.)
- */
-void tor_extended_socks_auth_request_free(tor_extended_socks_auth_request_t *victim);
-/** Try to parse a tor_extended_socks_auth_request from the buffer in
- * 'input', using up to 'len_in' bytes from the input buffer. On
- * success, return the number of bytes consumed and set *output to the
- * newly allocated tor_extended_socks_auth_request_t. On failure,
- * return -2 if the input appears truncated, and -1 if the input is
- * otherwise invalid.
- */
-ssize_t tor_extended_socks_auth_request_parse(tor_extended_socks_auth_request_t **output, const uint8_t *input, const size_t len_in);
-/** Return the number of bytes we expect to need to encode the
- * tor_extended_socks_auth_request in 'obj'. On failure, return a
- * negative value. Note that this value may be an overestimate, and
- * can even be an underestimate for certain unencodeable objects.
- */
-ssize_t tor_extended_socks_auth_request_encoded_len(const tor_extended_socks_auth_request_t *obj);
-/** Try to encode the tor_extended_socks_auth_request from 'input'
- * into the buffer at 'output', using up to 'avail' bytes of the
- * output buffer. On success, return the number of bytes used. On
- * failure, return -2 if the buffer was not long enough, and -1 if the
- * input was invalid.
- */
-ssize_t tor_extended_socks_auth_request_encode(uint8_t *output, size_t avail, const tor_extended_socks_auth_request_t *input);
-/** Check whether the internal state of the
- * tor_extended_socks_auth_request in 'obj' is consistent. Return NULL
- * if it is, and a short message if it is not.
- */
-const char *tor_extended_socks_auth_request_check(const tor_extended_socks_auth_request_t *obj);
-/** Clear any errors that were set on the object 'obj' by its setter
- * functions. Return true iff errors were cleared.
- */
-int tor_extended_socks_auth_request_clear_errors(tor_extended_socks_auth_request_t *obj);
-/** Return the value of the version field of the
- * tor_extended_socks_auth_request_t in 'inp'
- */
-uint8_t tor_extended_socks_auth_request_get_version(const tor_extended_socks_auth_request_t *inp);
-/** Set the value of the version field of the
- * tor_extended_socks_auth_request_t in 'inp' to 'val'. Return 0 on
- * success; return -1 and set the error code on 'inp' on failure.
- */
-int tor_extended_socks_auth_request_set_version(tor_extended_socks_auth_request_t *inp, uint8_t val);
-/** Return the value of the npairs field of the
- * tor_extended_socks_auth_request_t in 'inp'
- */
-uint16_t tor_extended_socks_auth_request_get_npairs(const tor_extended_socks_auth_request_t *inp);
-/** Set the value of the npairs field of the
- * tor_extended_socks_auth_request_t in 'inp' to 'val'. Return 0 on
- * success; return -1 and set the error code on 'inp' on failure.
- */
-int tor_extended_socks_auth_request_set_npairs(tor_extended_socks_auth_request_t *inp, uint16_t val);
-/** Return the length of the dynamic array holding the pairs field of
- * the tor_extended_socks_auth_request_t in 'inp'.
- */
-size_t tor_extended_socks_auth_request_getlen_pairs(const tor_extended_socks_auth_request_t *inp);
-/** Return the element at position 'idx' of the dynamic array field
- * pairs of the tor_extended_socks_auth_request_t in 'inp'.
- */
-struct tor_socksauth_keyval_st * tor_extended_socks_auth_request_get_pairs(tor_extended_socks_auth_request_t *inp, size_t idx);
-/** As tor_extended_socks_auth_request_get_pairs, but take and return
- * a const pointer
- */
- const struct tor_socksauth_keyval_st * tor_extended_socks_auth_request_getconst_pairs(const tor_extended_socks_auth_request_t *inp, size_t idx);
-/** Change the element at position 'idx' of the dynamic array field
- * pairs of the tor_extended_socks_auth_request_t in 'inp', so that it
- * will hold the value 'elt'. Free the previous value, if any.
- */
-int tor_extended_socks_auth_request_set_pairs(tor_extended_socks_auth_request_t *inp, size_t idx, struct tor_socksauth_keyval_st * elt);
-/** As tor_extended_socks_auth_request_set_pairs, but does not free
- * the previous value.
- */
-int tor_extended_socks_auth_request_set0_pairs(tor_extended_socks_auth_request_t *inp, size_t idx, struct tor_socksauth_keyval_st * elt);
-/** Append a new element 'elt' to the dynamic array field pairs of the
- * tor_extended_socks_auth_request_t in 'inp'.
- */
-int tor_extended_socks_auth_request_add_pairs(tor_extended_socks_auth_request_t *inp, struct tor_socksauth_keyval_st * elt);
-/** Return a pointer to the variable-length array field pairs of
- * 'inp'.
- */
-struct tor_socksauth_keyval_st * * tor_extended_socks_auth_request_getarray_pairs(tor_extended_socks_auth_request_t *inp);
-/** As tor_extended_socks_auth_request_get_pairs, but take and return
- * a const pointer
- */
-const struct tor_socksauth_keyval_st *  const  * tor_extended_socks_auth_request_getconstarray_pairs(const tor_extended_socks_auth_request_t *inp);
-/** Change the length of the variable-length array field pairs of
- * 'inp' to 'newlen'.Fill extra elements with NULL; free removed
- * elements. Return 0 on success; return -1 and set the error code on
- * 'inp' on failure.
- */
-int tor_extended_socks_auth_request_setlen_pairs(tor_extended_socks_auth_request_t *inp, size_t newlen);
-/** Return a newly allocated tor_extended_socks_auth_response with all
- * elements set to zero.
- */
-tor_extended_socks_auth_response_t *tor_extended_socks_auth_response_new(void);
-/** Release all storage held by the tor_extended_socks_auth_response
- * in 'victim'. (Do nothing if 'victim' is NULL.)
- */
-void tor_extended_socks_auth_response_free(tor_extended_socks_auth_response_t *victim);
-/** Try to parse a tor_extended_socks_auth_response from the buffer in
- * 'input', using up to 'len_in' bytes from the input buffer. On
- * success, return the number of bytes consumed and set *output to the
- * newly allocated tor_extended_socks_auth_response_t. On failure,
- * return -2 if the input appears truncated, and -1 if the input is
- * otherwise invalid.
- */
-ssize_t tor_extended_socks_auth_response_parse(tor_extended_socks_auth_response_t **output, const uint8_t *input, const size_t len_in);
-/** Return the number of bytes we expect to need to encode the
- * tor_extended_socks_auth_response in 'obj'. On failure, return a
- * negative value. Note that this value may be an overestimate, and
- * can even be an underestimate for certain unencodeable objects.
- */
-ssize_t tor_extended_socks_auth_response_encoded_len(const tor_extended_socks_auth_response_t *obj);
-/** Try to encode the tor_extended_socks_auth_response from 'input'
- * into the buffer at 'output', using up to 'avail' bytes of the
- * output buffer. On success, return the number of bytes used. On
- * failure, return -2 if the buffer was not long enough, and -1 if the
- * input was invalid.
- */
-ssize_t tor_extended_socks_auth_response_encode(uint8_t *output, size_t avail, const tor_extended_socks_auth_response_t *input);
-/** Check whether the internal state of the
- * tor_extended_socks_auth_response in 'obj' is consistent. Return
- * NULL if it is, and a short message if it is not.
- */
-const char *tor_extended_socks_auth_response_check(const tor_extended_socks_auth_response_t *obj);
-/** Clear any errors that were set on the object 'obj' by its setter
- * functions. Return true iff errors were cleared.
- */
-int tor_extended_socks_auth_response_clear_errors(tor_extended_socks_auth_response_t *obj);
-/** Return the value of the version field of the
- * tor_extended_socks_auth_response_t in 'inp'
- */
-uint8_t tor_extended_socks_auth_response_get_version(const tor_extended_socks_auth_response_t *inp);
-/** Set the value of the version field of the
- * tor_extended_socks_auth_response_t in 'inp' to 'val'. Return 0 on
- * success; return -1 and set the error code on 'inp' on failure.
- */
-int tor_extended_socks_auth_response_set_version(tor_extended_socks_auth_response_t *inp, uint8_t val);
-/** Return the value of the status field of the
- * tor_extended_socks_auth_response_t in 'inp'
- */
-uint8_t tor_extended_socks_auth_response_get_status(const tor_extended_socks_auth_response_t *inp);
-/** Set the value of the status field of the
- * tor_extended_socks_auth_response_t in 'inp' to 'val'. Return 0 on
- * success; return -1 and set the error code on 'inp' on failure.
- */
-int tor_extended_socks_auth_response_set_status(tor_extended_socks_auth_response_t *inp, uint8_t val);
-/** Return the value of the npairs field of the
- * tor_extended_socks_auth_response_t in 'inp'
- */
-uint16_t tor_extended_socks_auth_response_get_npairs(const tor_extended_socks_auth_response_t *inp);
-/** Set the value of the npairs field of the
- * tor_extended_socks_auth_response_t in 'inp' to 'val'. Return 0 on
- * success; return -1 and set the error code on 'inp' on failure.
- */
-int tor_extended_socks_auth_response_set_npairs(tor_extended_socks_auth_response_t *inp, uint16_t val);
-/** Return the length of the dynamic array holding the pairs field of
- * the tor_extended_socks_auth_response_t in 'inp'.
- */
-size_t tor_extended_socks_auth_response_getlen_pairs(const tor_extended_socks_auth_response_t *inp);
-/** Return the element at position 'idx' of the dynamic array field
- * pairs of the tor_extended_socks_auth_response_t in 'inp'.
- */
-struct tor_socksauth_keyval_st * tor_extended_socks_auth_response_get_pairs(tor_extended_socks_auth_response_t *inp, size_t idx);
-/** As tor_extended_socks_auth_response_get_pairs, but take and return
- * a const pointer
- */
- const struct tor_socksauth_keyval_st * tor_extended_socks_auth_response_getconst_pairs(const tor_extended_socks_auth_response_t *inp, size_t idx);
-/** Change the element at position 'idx' of the dynamic array field
- * pairs of the tor_extended_socks_auth_response_t in 'inp', so that
- * it will hold the value 'elt'. Free the previous value, if any.
- */
-int tor_extended_socks_auth_response_set_pairs(tor_extended_socks_auth_response_t *inp, size_t idx, struct tor_socksauth_keyval_st * elt);
-/** As tor_extended_socks_auth_response_set_pairs, but does not free
- * the previous value.
- */
-int tor_extended_socks_auth_response_set0_pairs(tor_extended_socks_auth_response_t *inp, size_t idx, struct tor_socksauth_keyval_st * elt);
-/** Append a new element 'elt' to the dynamic array field pairs of the
- * tor_extended_socks_auth_response_t in 'inp'.
- */
-int tor_extended_socks_auth_response_add_pairs(tor_extended_socks_auth_response_t *inp, struct tor_socksauth_keyval_st * elt);
-/** Return a pointer to the variable-length array field pairs of
- * 'inp'.
- */
-struct tor_socksauth_keyval_st * * tor_extended_socks_auth_response_getarray_pairs(tor_extended_socks_auth_response_t *inp);
-/** As tor_extended_socks_auth_response_get_pairs, but take and return
- * a const pointer
- */
-const struct tor_socksauth_keyval_st *  const  * tor_extended_socks_auth_response_getconstarray_pairs(const tor_extended_socks_auth_response_t *inp);
-/** Change the length of the variable-length array field pairs of
- * 'inp' to 'newlen'.Fill extra elements with NULL; free removed
- * elements. Return 0 on success; return -1 and set the error code on
- * 'inp' on failure.
- */
-int tor_extended_socks_auth_response_setlen_pairs(tor_extended_socks_auth_response_t *inp, size_t newlen);
 
 
 #endif

+ 0 - 22
src/trunnel/socks5.trunnel

@@ -92,25 +92,3 @@ struct socks4_server_reply {
    u32 addr;
 }
 
-// And here's the extended stuff from proposal 229
-
-struct tor_socksauth_keyval {
-  u16 keylen;
-  char key[keylen];
-  u16 vallen;
-  char val[vallen];
-}
-
-struct tor_extended_socks_auth_request {
-  u8 version IN [1];
-  u16 npairs;
-  struct tor_socksauth_keyval pairs[npairs];
-}
-
-struct tor_extended_socks_auth_response {
-  u8 version IN [1];
-  u8 status;
-  u16 npairs;
-  struct tor_socksauth_keyval pairs[npairs];
-}
-

Some files were not shown because too many files changed in this diff