BBS: TELESC.NET.BR Assunto: src/sftp/sftp.c sftp_common.csrc/sftp/objects.mk sftp.h sftp_attr.c sf De: Deuc¨ Data: Fri, 24 Apr 2026 14:19:27 -0700 ----------------------------------------------------------- https://gitlab.synchro.net/main/sbbs/-/commit/f193bd5695d05dcd9186ad10 Added Files: src/sftp/sftp.c sftp_common.c Modified Files: src/sftp/objects.mk sftp.h sftp_attr.c sftp_client.c sftp_pkt.c sftp_server.c sftp_str.c Removed Files: src/sftp/sftp_static.h Log Message: sftp: single-TU build + request-id dispatch + extension negotiation Rebuild the SFTP library as one translation unit (sftp.c #includes the five source files) so the compiler sees every internal function. Drop the cross-TU shim pattern that was in sftp_static.h its wrappers were only there to share state-oriented helpers between client.c and server.c across TU boundaries, which is moot now. The file is renamed to sftp_common.c and reduced to genuinely shared pieces (extension table, appendheader). Non-public functions lose their sftp_*_ prefix and become static. Public API in sftp.h is unchanged from the consumer's POV; only 60 T-symbols remain in libsftp_mt.a, all legitimately public. Client gets a request-id demux (struct sftpc_pending per in-flight op on the caller's stack; sftpc_recv dispatches completed packets to the matching waiter's event) plus new ops: stat / lstat / fstat / opendir / readdir / mkdir / rmdir / remove / rename / setstat / fsetstat. Per-thread last-error via pthread_key_t so concurrent callers don't clobber each other's status. INIT/VERSION now negotiate extensions: both sides advertise (name, version) pairs; an extension is enabled only when name AND version match. Initial extensions: lname@syncterm.net and descs@syncterm.net, both at version "1". sftps_state_t now splits into a public outer struct (callbacks, version, extensions) and an opaque priv struct (rxp/txp/mtx/running/ id/terminating) living inside the TU so consumers can't tamper with internal fields. Packet struct bodies (sftp_tx_pkt, sftp_rx_pkt, sftp_extended_file_attribute) move out of sftp.h for the same reason. Client ops validate NULL/range args before taking the mutex so a doomed call never acquires the lock. Co-Authored-By: Claude Opus 4.7 (1M context)n --- mSynchronetn hgVertrauen n hHome of Synchronet n gh[vert/cvs/bbs].synchro.net ----------------------------------------------------------- [Voltar]