Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sth fixes - one memory crash and some formatting and build options #344

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4979f73
Allow \<space> to replace \b to represent blanks in file names. Make…
sth0 Feb 12, 2024
1b1e3ca
Merge branch 'sth-mem-leak' into master-sth and timestamp fix
sth0 Feb 12, 2024
634d5a1
Merge branch 'sth-escaped-spaces' into master-sth
sth0 Feb 12, 2024
1232e6c
Update directions for installing with fink libraries and having "dist…
sth0 Feb 14, 2024
b908e2e
change to unsigned char pointers to remove compiler warnings
sth0 Feb 14, 2024
789f586
Merge branch 'sth-cleanup' into master-sth
sth0 Feb 14, 2024
101a938
Updated work flow to load missing components on macOS AND to checkout…
sth0 Feb 15, 2024
9852896
Merge branch 'sth-workflow' into master-sth
sth0 Feb 15, 2024
fc84997
removed auto inserted tabs.
sth0 Feb 15, 2024
e50f523
Merge branch 'sth-workflow' into master-sth
sth0 Feb 15, 2024
a36165b
Moved redundant free call
sth0 Feb 16, 2024
bb146d1
Merge branch 'sth-mem-leak' into master-sth
sth0 Feb 16, 2024
cca2a09
Tweak to match cleanup branch.
sth0 Feb 16, 2024
7784da8
submodule commit?
sth0 Feb 16, 2024
d64e803
Updated documentation for fink assisted installation. Added changes …
sth0 Feb 19, 2024
85ca751
Merge branch 'master' of https://github.com/Radmind/radmind into mast…
sth0 Feb 20, 2024
3de4dc3
deleted extra EVP_MD_CTX_free call once again!
sth0 Feb 20, 2024
c7ec191
Merge branch 'sth-mem-leak' of https://github.com/sth0/radmind into s…
sth0 Feb 20, 2024
2daee1a
Merge commit 'cca2a09623d257db1d7c0aba84e1d0fa9de5b598' into sth-fixes
sth0 Feb 20, 2024
2bb9498
Merge commit 'd64e803c040f7900356d907111217c1a7c87aa7c' into sth-fixes
sth0 Feb 20, 2024
7463e10
Merge commit '85ca75105e79cf76fabb62db48db5ef6d1191a85' into sth-fixes
sth0 Feb 20, 2024
2acc6da
Merge branch 'master-sth' into sth-fixes
sth0 Feb 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
submodules: recursive
- name: Configure
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew install openssl
brew install openssl cyrus-sasl autoconf
sudo ln -s /usr/local/opt/openssl /usr/local/openssl
fi
sh bootstrap.sh
Expand Down
8 changes: 5 additions & 3 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ lsort: libsnet/libsnet.la ${LSORT_OBJ}

FRC :

# build of universal library (lipo) fails on macOS if jobs > 1
# Scott Hannahs <[email protected]>
libsnet/libsnet.la : FRC
cd libsnet; ${MAKE}
cd libsnet; ${MAKE} -j 1

VERSION= $(shell date +%Y%m%d%H%M)
DISTDIR= radmind-${VERSION}
Expand Down Expand Up @@ -394,7 +396,7 @@ clean :
rm -rf tmp

distclean: clean
rm -f config.log config.status Makefile config.h
rm -rf autom4te.cache
rm -f config.log config.status config.cache Makefile config.h configure
rm -rf autom4te.cache profiled
rm -rf .#*
cd libsnet; make distclean
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,30 @@ brew install openssl
sudo ln -s /usr/local/opt/openssl /usr/local/openssl
```

Last tested on 10.14 (using fink)
Last tested on MacOS 13.6 (using fink)

- Install [Xcode](https://developer.apple.com/xcode/).
- Install [fink](https://finkproject.org).

Run these commands as an admin user.
Run these commands as and admin user.

If making universal binaries -use lipo after fink, to create universal binaries, for libsasl2.3.dylib, libssl.1.1.dylib, and libcrypto.1.1.dylib)
For example if you have another architecture mounted remotely
```
cd /opt/sw/lib
sudo lipo -create -output libsasl2.3.dylib libsasl2.3.dylib /Volumes/<remote with other arch>/opt/sw/lib/libsasl2.3.dylib
```
fink install autoconf
fink install openssl
Will create the library on the local volume for the libsasl, the other 2 libraries can be merged the same way.

```
fink install autoconf2.6 openssl110-dev cyrus-sasl2.3-dev

cd libsnet
autoconf
cd ..
autoconf
./configure LDFLAGS='-L/opt/sw/lib -lsasl2' CFLAGS='-I/opt/sw/include' --with-zlib=/opt/sw/lib/ --enable-universal-binaries
make all
```

### Configuring for Raspbian Stretch (Debian 9)
Expand Down
9 changes: 8 additions & 1 deletion aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ AC_DEFUN([CHECK_UNIVERSAL_BINARIES],
LDFLAGS="$LDFLAGS -L/Developer/SDKs/$macosx_sdk/usr/lib"
;;

darwin22*|darwin21*|darwin20*)
dep_target="-mmacosx-version-min=10.9"
arches="-arch x86_64 -arch arm64"
macosx_sdk="`xcrun --show-sdk-path`"
LDFLAGS="$LDFLAGS -L$macosx_sdk/usr/lib"
;;

*)
AC_MSG_ERROR([Building universal binaries on ${host_os} is not supported])
;;
Expand All @@ -120,7 +127,7 @@ AC_DEFUN([CHECK_UNIVERSAL_BINARIES],
echo ===========================================================
echo Setting up universal binaries for ${host_os}
echo ===========================================================
OPTOPTS="$OPTOPTS -isysroot /Developer/SDKs/$macosx_sdk $dep_target $arches"
OPTOPTS="$OPTOPTS -isysroot $macosx_sdk $dep_target $arches"
fi
])

Expand Down
10 changes: 9 additions & 1 deletion argcargv.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ acav_parse( ACAV *acav, char *line, char **argv[] )
{
int ac;
int state;
char * pline = line;

if ( acav == NULL ) {
if ( acavg == NULL ) {
Expand All @@ -60,14 +61,21 @@ acav_parse( ACAV *acav, char *line, char **argv[] )

for ( ; *line != '\0'; line++ ) {
switch ( *line ) {
case ' ' :
case '\t' :
case '\n' :
if ( state == ACV_WORD ) {
*line = '\0';
state = ACV_WHITE;
}
break;
case ' ' :
if ( ( line == pline ) || ( *(line-1) != '\\') ) {
if ( state == ACV_WORD ) {
*line = '\0';
state = ACV_WHITE;
}
break;
}
default :
if ( state == ACV_WHITE ) {
acav->acv_argv[ ac++ ] = line;
Expand Down
3 changes: 2 additions & 1 deletion code.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ encode( char *line )
case ' ' :
*temp = '\\';
temp++;
*temp = 'b';
*temp = ' ';
break;
case '\t' :
*temp = '\\';
Expand Down Expand Up @@ -96,6 +96,7 @@ decode( char *line )
*temp = '\t';
break;
case 'b':
case ' ':
*temp = ' ';
break;
case 'r':
Expand Down
2 changes: 1 addition & 1 deletion libsnet
Submodule libsnet updated from 59d26a to 7e9dd4
7 changes: 3 additions & 4 deletions retr.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ retr( SNET *sn, char *pathdesc, char *path, char *temppath, mode_t tempmode,
if ( cksum ) {
EVP_DigestFinal( mdctx, md_value, &md_len );
base64_e( md_value, md_len, cksum_b64 );
EVP_MD_CTX_free(mdctx);
if ( strcmp( trancksum, cksum_b64 ) != 0 ) {
fprintf( stderr, "line %d: checksum in transcript does not match "
"checksum from server\n", linenum );
Expand Down Expand Up @@ -554,12 +553,11 @@ retr_applefile( SNET *sn, char *pathdesc, char *path, char *temppath,

if ( cksum ) {
EVP_DigestFinal( mdctx, md_value, &md_len );
base64_e(( char*)&md_value, md_len, cksum_b64 );
EVP_MD_CTX_free(mdctx);
base64_e( ( unsigned char * ) md_value, md_len, cksum_b64 );
if ( strcmp( trancksum, cksum_b64 ) != 0 ) {
fprintf( stderr, "line %d: checksum in transcript does not match "
"checksum from server\n", linenum );
fprintf( stderr, "%s\n", pathdesc );
fprintf( stderr, "%s\n", pathdesc );
returnval = 1;
goto error1;
}
Expand All @@ -574,6 +572,7 @@ retr_applefile( SNET *sn, char *pathdesc, char *path, char *temppath,
close( dfd );
error1:
unlink( temppath );
EVP_MD_CTX_free(mdctx);
return( returnval );
}

Expand Down
16 changes: 4 additions & 12 deletions stor.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ stor_file( SNET *sn, char *pathdesc, char *path, off_t transize,
/* cksum data sent */
if ( cksum ) {
EVP_DigestFinal( mdctx, md_value, &md_len );
base64_e( md_value, md_len, cksum_b64 );
base64_e( ( unsigned char * ) md_value, md_len, cksum_b64 );
EVP_MD_CTX_free(mdctx);
if ( strcmp( trancksum, cksum_b64 ) != 0 ) {
fprintf( stderr,
Expand Down Expand Up @@ -337,7 +337,6 @@ stor_applefile( SNET *sn, char *pathdesc, char *path, off_t transize,
AS_HEADERLEN ) {
fprintf( stderr, "stor_applefile %s failed: %s\n", pathdesc,
strerror( errno ));
EVP_MD_CTX_free( mdctx );
return( -1 );
}
size -= AS_HEADERLEN;
Expand All @@ -356,7 +355,6 @@ stor_applefile( SNET *sn, char *pathdesc, char *path, off_t transize,
!= ( 3 * sizeof( struct as_entry ))) {
fprintf( stderr, "stor_applefile %s failed: %s\n", pathdesc,
strerror( errno ));
EVP_MD_CTX_free( mdctx );
return( -1 );
}
size -= ( 3 * sizeof( struct as_entry ));
Expand All @@ -375,7 +373,6 @@ stor_applefile( SNET *sn, char *pathdesc, char *path, off_t transize,
&tv ) != FINFOLEN ) {
fprintf( stderr, "stor_applefile %s failed: %s\n", pathdesc,
strerror( errno ));
EVP_MD_CTX_free( mdctx );
return( -1 );
}
size -= FINFOLEN;
Expand All @@ -394,7 +391,6 @@ stor_applefile( SNET *sn, char *pathdesc, char *path, off_t transize,
if ( snet_write( sn, buf, rc, &tv ) != rc ) {
fprintf( stderr, "stor_applefile %s failed: %s\n", pathdesc,
strerror( errno ));
EVP_MD_CTX_free( mdctx );
return( -1 );
}
size -= rc;
Expand Down Expand Up @@ -448,7 +444,6 @@ stor_applefile( SNET *sn, char *pathdesc, char *path, off_t transize,
if ( snet_writef( sn, ".\r\n" ) < 0 ) {
fprintf( stderr, "stor_applefile %s failed: %s\n", pathdesc,
strerror( errno ));
EVP_MD_CTX_free( mdctx );
return( -1 );
}
if ( verbose ) fputs( "\n>>> .\n", stdout );
Expand All @@ -471,18 +466,15 @@ stor_applefile( SNET *sn, char *pathdesc, char *path, off_t transize,
/* cksum data sent */
if ( cksum ) {
EVP_DigestFinal( mdctx, md_value, &md_len );
base64_e( ( char*)&md_value, md_len, cksum_b64 );
base64_e( ( unsigned char * ) md_value, md_len, cksum_b64 );
EVP_MD_CTX_free(mdctx);
if ( strcmp( trancksum, cksum_b64 ) != 0 ) {
fprintf( stderr,
"line %d: checksum listed in transcript wrong\n", linenum );
if ( ! force ) {
EVP_MD_CTX_free(mdctx);
exit( 2 );
}
if ( ! force ) exit( 2 );
}
}

EVP_MD_CTX_free( mdctx );
if ( !quiet && !showprogress ) printf( "%s: stored\n", path );
return( 0 );
}
Expand Down
Loading