ports/ftp/bbftp-client/files/patch-connecttoserver.c
Alexey Dokuchaev 06105161eb - Split into client and server ports: upstream now provides separate
distfiles and also this allows to simplify configure and build glue
  in the Makefiles considerably
- Update to version 3.2.1, reword both COMMENTs accordingly
- Actualize MASTER_SITES and WWW line in the port description
- Unbreak the build against contemporary versions of OpenSSL
- Define LICENSE (GPLv2+) and install provided documentation files
2021-01-30 09:01:08 +00:00

55 lines
2.2 KiB
C

--- connecttoserver.c.orig 2013-02-07 10:42:46 UTC
+++ connecttoserver.c
@@ -517,6 +517,7 @@ int connectviapassword()
#ifdef WITH_SSL
RSA *hisrsa ;
int lenrsa ;
+ BIGNUM *n, *e;
#endif
/*
** Get the socket
@@ -629,33 +630,35 @@ int connectviapassword()
/*
** Getting BIGNUM structures to store the key and exponent
*/
- if ( (hisrsa->n = BN_new()) == NULL) {
+ n = BN_new();
+ e = BN_new();
+ if (n == NULL || e == NULL) {
free(readbuffer) ;
close(tmpctrlsock) ;
printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ;
return -1 ;
}
- if ( (hisrsa->e = BN_new()) == NULL) {
- free(readbuffer) ;
- close(tmpctrlsock) ;
- printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ;
- return -1 ;
- }
/*
** Copy the key and exponent received
*/
- if ( BN_mpi2bn(pubkey,lenkey,hisrsa->n) == NULL ) {
+ if ( BN_mpi2bn(pubkey,lenkey,n) == NULL ) {
free(readbuffer) ;
close(tmpctrlsock) ;
printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubkey",(char *) ERR_error_string(ERR_get_error(),NULL)) ;
return -1 ;
}
- if ( BN_mpi2bn(pubexponent,lenexpo,hisrsa->e) == NULL ) {
+ if ( BN_mpi2bn(pubexponent,lenexpo,e) == NULL ) {
free(readbuffer) ;
close(tmpctrlsock) ;
printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubexponent",(char *) ERR_error_string(ERR_get_error(),NULL)) ;
return -1 ;
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ hisrsa->n = n;
+ hisrsa->e = e;
+#else
+ RSA_set0_key(hisrsa, n, e, NULL);
+#endif
lenrsa = RSA_size(hisrsa) ;
if (strlen(username) > lenrsa - 41 ) {