1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-20 02:42:09 +03:00

src: fix indentation of macro definitions

And some comment cleanup.

Closes #958
This commit is contained in:
Viktor Szakats
2023-04-13 23:39:01 +00:00
parent f4f5841dd5
commit d5438f4ba9
22 changed files with 383 additions and 401 deletions

View File

@@ -679,7 +679,7 @@ agent_free_identities(LIBSSH2_AGENT *agent)
#define AGENT_PUBLICKEY_MAGIC 0x3bdefed2
/*
* agent_publickey_to_external()
* agent_publickey_to_external
*
* Copies data from the internal to the external representation struct.
*
@@ -727,7 +727,7 @@ libssh2_agent_init(LIBSSH2_SESSION *session)
}
/*
* libssh2_agent_connect()
* libssh2_agent_connect
*
* Connect to an ssh-agent.
*
@@ -747,7 +747,7 @@ libssh2_agent_connect(LIBSSH2_AGENT *agent)
}
/*
* libssh2_agent_list_identities()
* libssh2_agent_list_identities
*
* Request ssh-agent to list identities.
*
@@ -763,7 +763,7 @@ libssh2_agent_list_identities(LIBSSH2_AGENT *agent)
}
/*
* libssh2_agent_get_identity()
* libssh2_agent_get_identity
*
* Traverse the internal list of public keys. Pass NULL to 'prev' to get
* the first one. Or pass a pointer to the previously returned one to get the
@@ -800,7 +800,7 @@ libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
}
/*
* libssh2_agent_userauth()
* libssh2_agent_userauth
*
* Do publickey user authentication with the help of ssh-agent.
*
@@ -830,7 +830,7 @@ libssh2_agent_userauth(LIBSSH2_AGENT *agent,
}
/*
* libssh2_agent_disconnect()
* libssh2_agent_disconnect
*
* Close a connection to an ssh-agent.
*
@@ -845,7 +845,7 @@ libssh2_agent_disconnect(LIBSSH2_AGENT *agent)
}
/*
* libssh2_agent_free()
* libssh2_agent_free
*
* Free an ssh-agent handle. This function also frees the internal
* collection of public keys.
@@ -866,7 +866,7 @@ libssh2_agent_free(LIBSSH2_AGENT *agent)
}
/*
* libssh2_agent_set_identity_path()
* libssh2_agent_set_identity_path
*
* Allows a custom agent socket path beyond SSH_AUTH_SOCK env
*
@@ -891,7 +891,7 @@ libssh2_agent_set_identity_path(LIBSSH2_AGENT *agent, const char *path)
}
/*
* libssh2_agent_get_identity_path()
* libssh2_agent_get_identity_path
*
* Returns the custom agent socket path if set
*

View File

@@ -1207,13 +1207,14 @@ static int channel_request_auth_agent(LIBSSH2_CHANNEL *channel,
"Unable to complete request for auth-agent");
}
/**
/*
* libssh2_channel_request_auth_agent
*
* Requests that agent forwarding be enabled for the session. The
* request must be sent over a specific channel, which starts the agent
* listener on the remote side. Once the channel is closed, the agent
* listener continues to exist.
* */
*/
LIBSSH2_API int
libssh2_channel_request_auth_agent(LIBSSH2_CHANNEL *channel)
{
@@ -2017,7 +2018,7 @@ _libssh2_channel_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode)
}
/*
* libssh2_channel_handle_extended_data2()
* libssh2_channel_handle_extended_data2
*
*/
LIBSSH2_API int

View File

@@ -1367,7 +1367,7 @@ static int hostkey_type(const unsigned char *hostkey, size_t len)
}
/*
* libssh2_session_hostkey()
* libssh2_session_hostkey
*
* Returns the server key and length.
*

View File

@@ -2196,7 +2196,6 @@ clean_exit:
* supports SHA256/384/512 hashes based on negotiated ecdh method
*
*/
static int
kex_method_ecdh_key_exchange
(LIBSSH2_SESSION * session, key_exchange_state_low_t * key_state)
@@ -3052,6 +3051,7 @@ typedef struct _LIBSSH2_COMMON_METHOD
} LIBSSH2_COMMON_METHOD;
/* kex_method_strlen
*
* Calculate the length of a particular method list's resulting string
* Includes SUM(strlen() of each individual method plus 1 (for coma)) - 1
* (because the last coma isn't used)
@@ -3296,7 +3296,7 @@ static int kexinit(LIBSSH2_SESSION * session)
/* kex_agree_instr
* Kex specific variant of strstr()
* Needle must be precede by BOL or ',', and followed by ',' or EOL
* Needle must be preceded by BOL or ',', and followed by ',' or EOL
*/
static unsigned char *
kex_agree_instr(unsigned char *haystack, size_t haystack_len,
@@ -4055,7 +4055,7 @@ libssh2_session_method_pref(LIBSSH2_SESSION * session, int method_type,
}
/*
* libssh2_session_supported_algs()
* libssh2_session_supported_algs
* returns a number of returned algorithms (a positive number) on success,
* a negative number on failure
*/

View File

@@ -110,7 +110,7 @@ libssh2_knownhost_init(LIBSSH2_SESSION *session)
#define KNOWNHOST_MAGIC 0xdeadcafe
/*
* knownhost_to_external()
* knownhost_to_external
*
* Copies data from the internal to the external representation struct.
*
@@ -726,7 +726,7 @@ static int hashed_hostline(LIBSSH2_KNOWNHOSTS *hosts,
}
/*
* hostline()
* hostline
*
* Parse a single known_host line pre-split into host and key.
*
@@ -840,7 +840,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts,
}
/*
* libssh2_knownhost_readline()
* libssh2_knownhost_readline
*
* Pass in a line of a file of 'type'.
*
@@ -982,7 +982,7 @@ libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts,
}
/*
* knownhost_writeline()
* knownhost_writeline
*
* Ask libssh2 to convert a known host to an output line for storage.
*
@@ -1156,7 +1156,7 @@ knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts,
}
/*
* libssh2_knownhost_writeline()
* libssh2_knownhost_writeline
*
* Ask libssh2 to convert a known host to an output line for storage.
*
@@ -1182,7 +1182,7 @@ libssh2_knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts,
}
/*
* libssh2_knownhost_writefile()
* libssh2_knownhost_writefile
*
* Write hosts+key pairs to the given file.
*/
@@ -1233,7 +1233,7 @@ libssh2_knownhost_writefile(LIBSSH2_KNOWNHOSTS *hosts,
/*
* libssh2_knownhost_get()
* libssh2_knownhost_get
*
* Traverse the internal list of known hosts. Pass NULL to 'prev' to get
* the first one.

View File

@@ -40,6 +40,7 @@
#if defined(LIBSSH2DEBUG) && defined(LIBSSH2_MAC_NONE_INSECURE)
/* mac_none_MAC
*
* Minimalist MAC: No MAC. DO NOT USE.
*
* The SSH2 Transport allows implementations to forego a message

View File

@@ -375,7 +375,7 @@ static const char table64[]=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/*
* _libssh2_base64_encode()
* _libssh2_base64_encode
*
* Returns the length of the newly created base64 string. The third argument
* is a pointer to an allocated area holding the base64 data. If something
@@ -656,7 +656,7 @@ void _libssh2_list_insert(struct list_node *after, /* insert before this */
/* this define is defined in misc.h for the correct platforms */
#ifdef LIBSSH2_GETTIMEOFDAY_WIN32
/*
* gettimeofday
* _libssh2_gettimeofday
* Implementation according to:
* The Open Group Base Specifications Issue 6
* IEEE Std 1003.1, 2004 Edition

View File

@@ -606,7 +606,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
}
/*
* _libssh2_debug will actually truncate this for us so
* _libssh2_debug() will actually truncate this for us so
* that it's not an inordinate about of data
*/
_libssh2_debug((session, LIBSSH2_TRACE_TRANS,

View File

@@ -826,7 +826,7 @@ libssh2_scp_recv2(LIBSSH2_SESSION *session, const char *path,
}
/*
* scp_send()
* scp_send
*
* Send a file using SCP
*

View File

@@ -356,7 +356,7 @@ session_nonblock(libssh2_socket_t sockfd, /* operate on this */
}
/*
* get_socket_nonblocking()
* get_socket_nonblocking
*
* gets the given blocking or non-blocking state of the socket.
*/
@@ -602,7 +602,7 @@ libssh2_session_callback_set(LIBSSH2_SESSION * session,
#endif
/*
* _libssh2_wait_socket()
* _libssh2_wait_socket
*
* Utility function that waits for action on the socket. Returns 0 when ready
* to run again or error on timeout.
@@ -853,7 +853,7 @@ session_startup(LIBSSH2_SESSION *session, libssh2_socket_t sock)
}
/*
* libssh2_session_handshake()
* libssh2_session_handshake
*
* session: LIBSSH2_SESSION struct allocated and owned by the calling program
* sock: *must* be populated with an opened and connected socket.
@@ -871,7 +871,7 @@ libssh2_session_handshake(LIBSSH2_SESSION *session, libssh2_socket_t sock)
}
/*
* libssh2_session_startup()
* libssh2_session_startup
*
* DEPRECATED. Use libssh2_session_handshake() instead! This function is not
* portable enough.
@@ -888,7 +888,7 @@ libssh2_session_startup(LIBSSH2_SESSION *session, int sock)
}
/*
* libssh2_session_free
* session_free
*
* Frees the memory allocated to the session
* Also closes and frees any channels attached to this session
@@ -1164,7 +1164,7 @@ libssh2_session_free(LIBSSH2_SESSION * session)
}
/*
* libssh2_session_disconnect_ex
* session_disconnect
*/
static int
session_disconnect(LIBSSH2_SESSION *session, int reason,

View File

@@ -180,9 +180,7 @@ add_zombie_request(LIBSSH2_SFTP *sftp, uint32_t request_id)
}
}
/*
* sftp_packet_add
*
/* sftp_packet_add
* Add a packet to the SFTP packet brigade
*/
static int
@@ -276,9 +274,7 @@ sftp_packet_add(LIBSSH2_SFTP *sftp, unsigned char *data,
return LIBSSH2_ERROR_NONE;
}
/*
* sftp_packet_read
*
/* sftp_packet_read
* Frame an SFTP packet off the channel
*/
static int
@@ -421,8 +417,8 @@ sftp_packet_read(LIBSSH2_SFTP *sftp)
}
/* WON'T REACH */
}
/*
* sftp_packetlist_flush
/* sftp_packetlist_flush
*
* Remove all pending packets in the packet_list and the corresponding one(s)
* in the SFTP packet brigade.
@@ -463,7 +459,7 @@ static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle)
/*
* sftp_packet_ask()
* sftp_packet_ask
*
* Checks if there's a matching SFTP packet available.
*/
@@ -761,9 +757,7 @@ LIBSSH2_CHANNEL_CLOSE_FUNC(libssh2_sftp_dtor)
LIBSSH2_FREE(session, sftp);
}
/*
* sftp_init
*
/* sftp_init
* Startup an SFTP session
*/
static LIBSSH2_SFTP *sftp_init(LIBSSH2_SESSION *session)
@@ -987,9 +981,7 @@ static LIBSSH2_SFTP *sftp_init(LIBSSH2_SESSION *session)
return NULL;
}
/*
* libssh2_sftp_init
*
/* libssh2_sftp_init
* Startup an SFTP session
*/
LIBSSH2_API LIBSSH2_SFTP *libssh2_sftp_init(LIBSSH2_SESSION *session)
@@ -1009,9 +1001,7 @@ LIBSSH2_API LIBSSH2_SFTP *libssh2_sftp_init(LIBSSH2_SESSION *session)
return ptr;
}
/*
* sftp_shutdown
*
/* sftp_shutdown
* Shuts down the SFTP subsystem
*/
static int
@@ -1357,11 +1347,8 @@ libssh2_sftp_open_ex_r(LIBSSH2_SFTP *sftp, const char *filename,
return hnd;
}
/*
* sftp_read
*
/* sftp_read
* Read from an SFTP file handle
*
*/
static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE * handle, char *buffer,
size_t buffer_size)
@@ -2006,8 +1993,7 @@ libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *hnd, char *buffer,
return (int)rc; /* FIXME: -> ssize_t */
}
/*
* sftp_write
/* sftp_write
*
* Write data to an SFTP handle. Returns the number of bytes written, or
* a negative error code.
@@ -2375,9 +2361,7 @@ libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *hnd)
}
/*
* sftp_fstat
*
/* sftp_fstat
* Get or Set stat on a file
*/
static int sftp_fstat(LIBSSH2_SFTP_HANDLE *handle,
@@ -2842,9 +2826,7 @@ libssh2_sftp_unlink_ex(LIBSSH2_SFTP *sftp, const char *filename,
return rc;
}
/*
* sftp_rename
*
/* sftp_rename
* Rename a file on the remote server
*/
static int sftp_rename(LIBSSH2_SFTP *sftp, const char *source_filename,
@@ -2986,9 +2968,7 @@ libssh2_sftp_rename_ex(LIBSSH2_SFTP *sftp, const char *source_filename,
return rc;
}
/*
* sftp_fstatvfs
*
/* sftp_fstatvfs
* Get file system statistics
*/
static int sftp_fstatvfs(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_STATVFS *st)
@@ -3124,9 +3104,7 @@ libssh2_sftp_fstatvfs(LIBSSH2_SFTP_HANDLE *handle, LIBSSH2_SFTP_STATVFS *st)
return rc;
}
/*
* sftp_statvfs
*
/* sftp_statvfs
* Get file system statistics
*/
static int sftp_statvfs(LIBSSH2_SFTP *sftp, const char *path,
@@ -3263,9 +3241,7 @@ libssh2_sftp_statvfs(LIBSSH2_SFTP *sftp, const char *path,
}
/*
* sftp_mkdir
*
/* sftp_mkdir
* Create an SFTP directory
*/
static int sftp_mkdir(LIBSSH2_SFTP *sftp, const char *path,
@@ -3369,9 +3345,7 @@ static int sftp_mkdir(LIBSSH2_SFTP *sftp, const char *path,
}
}
/*
* libssh2_sftp_mkdir_ex
*
/* libssh2_sftp_mkdir_ex
* Create an SFTP directory
*/
LIBSSH2_API int

View File

@@ -605,7 +605,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
if(session->packAdd_state != libssh2_NB_state_idle) {
/* fullpacket only returns LIBSSH2_ERROR_EAGAIN if
* libssh2_packet_add returns LIBSSH2_ERROR_EAGAIN. If
* libssh2_packet_add() returns LIBSSH2_ERROR_EAGAIN. If
* that returns LIBSSH2_ERROR_EAGAIN but the packAdd_state
* is idle, then the packet has been added to the brigade,
* but some immediate action that was taken based on the

View File

@@ -43,7 +43,6 @@
#include "libssh2_priv.h"
#include "packet.h"
/*
* libssh2_transport_send
*

View File

@@ -54,7 +54,7 @@
#include "userauth.h"
#include "userauth_kbd_packet.h"
/* libssh2_userauth_list
/* userauth_list
*
* List authentication methods
* Will yield successful login if "none" happens to be allowable for this user
@@ -1037,7 +1037,7 @@ userauth_hostbased_fromfile(LIBSSH2_SESSION *session,
&pubkeydata, &pubkeydata_len,
privatekey, passphrase);
if(rc)
/* libssh2_pub_priv_keyfile calls _libssh2_error() */
/* libssh2_pub_priv_keyfile() calls _libssh2_error() */
return rc;
}
@@ -2282,7 +2282,9 @@ libssh2_userauth_keyboard_interactive_ex(LIBSSH2_SESSION *session,
return rc;
}
/* libssh2_userauth_publickey_sk
/*
* libssh2_userauth_publickey_sk
*
* Authenticate using an external callback function
*/
LIBSSH2_API int

View File

@@ -2447,7 +2447,7 @@ _libssh2_dh_key_pair(_libssh2_dh_ctx *dhctx, _libssh2_bn *public,
/* Pass ownership to dhctx; these parameters will be freed when
* the context is destroyed. We need to keep the parameters more
* easily available so that we have access to the `g` value when
* _libssh2_dh_secret is called later. */
* _libssh2_dh_secret() is called later. */
dhctx->dh_params = dh_params;
}
dh_params = NULL;

View File

@@ -153,7 +153,8 @@ typedef struct __libssh2_wincng_hash_ctx {
(_libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHashSHA1, \
SHA_DIGEST_LENGTH, NULL, 0) == 0)
#define libssh2_sha1_update(ctx, data, datalen) \
_libssh2_wincng_hash_update(&ctx, (const unsigned char *) data, \
_libssh2_wincng_hash_update(&ctx, \
(const unsigned char *) data, \
(unsigned long) datalen)
#define libssh2_sha1_final(ctx, hash) \
_libssh2_wincng_hash_final(&ctx, hash)
@@ -166,7 +167,8 @@ typedef struct __libssh2_wincng_hash_ctx {
(_libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHashSHA256, \
SHA256_DIGEST_LENGTH, NULL, 0) == 0)
#define libssh2_sha256_update(ctx, data, datalen) \
_libssh2_wincng_hash_update(&ctx, (const unsigned char *) data, \
_libssh2_wincng_hash_update(&ctx, \
(const unsigned char *) data, \
(unsigned long) datalen)
#define libssh2_sha256_final(ctx, hash) \
_libssh2_wincng_hash_final(&ctx, hash)
@@ -179,7 +181,8 @@ typedef struct __libssh2_wincng_hash_ctx {
(_libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHashSHA384, \
SHA384_DIGEST_LENGTH, NULL, 0) == 0)
#define libssh2_sha384_update(ctx, data, datalen) \
_libssh2_wincng_hash_update(&ctx, (const unsigned char *) data, \
_libssh2_wincng_hash_update(&ctx, \
(const unsigned char *) data, \
(unsigned long) datalen)
#define libssh2_sha384_final(ctx, hash) \
_libssh2_wincng_hash_final(&ctx, hash)
@@ -192,7 +195,8 @@ typedef struct __libssh2_wincng_hash_ctx {
(_libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHashSHA512, \
SHA512_DIGEST_LENGTH, NULL, 0) == 0)
#define libssh2_sha512_update(ctx, data, datalen) \
_libssh2_wincng_hash_update(&ctx, (const unsigned char *) data, \
_libssh2_wincng_hash_update(&ctx, \
(const unsigned char *) data, \
(unsigned long) datalen)
#define libssh2_sha512_final(ctx, hash) \
_libssh2_wincng_hash_final(&ctx, hash)
@@ -205,7 +209,8 @@ typedef struct __libssh2_wincng_hash_ctx {
(_libssh2_wincng_hash_init(ctx, _libssh2_wincng.hAlgHashMD5, \
MD5_DIGEST_LENGTH, NULL, 0) == 0)
#define libssh2_md5_update(ctx, data, datalen) \
_libssh2_wincng_hash_update(&ctx, (const unsigned char *) data, \
_libssh2_wincng_hash_update(&ctx, \
(const unsigned char *) data, \
(unsigned long) datalen)
#define libssh2_md5_final(ctx, hash) \
_libssh2_wincng_hash_final(&ctx, hash)