lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

002-fix_pointer.patch (12419B)


      1 --- a/ssmtp.c
      2 +++ b/ssmtp.c
      3 @@ -55,21 +55,21 @@ bool_t use_oldauth = False;		/* use old
      4  
      5  #define ARPADATE_LENGTH 32		/* Current date in RFC format */
      6  char arpadate[ARPADATE_LENGTH];
      7 -char *auth_user = (char)NULL;
      8 -char *auth_pass = (char)NULL;
      9 -char *auth_method = (char)NULL;		/* Mechanism for SMTP authentication */
     10 -char *mail_domain = (char)NULL;
     11 -char *from = (char)NULL;		/* Use this as the From: address */
     12 +char *auth_user = NULL;
     13 +char *auth_pass = NULL;
     14 +char *auth_method = NULL;		/* Mechanism for SMTP authentication */
     15 +char *mail_domain = NULL;
     16 +char *from = NULL;		/* Use this as the From: address */
     17  char *hostname;
     18  char *mailhost = "mailhub";
     19 -char *minus_f = (char)NULL;
     20 -char *minus_F = (char)NULL;
     21 +char *minus_f = NULL;
     22 +char *minus_F = NULL;
     23  char *gecos;
     24 -char *prog = (char)NULL;
     25 +char *prog = NULL;
     26  char *root = NULL;
     27  char *tls_cert = "/etc/ssl/certs/ssmtp.pem";	/* Default Certificate */
     28 -char *uad = (char)NULL;
     29 -char *config_file = (char)NULL;		/* alternate configuration file */
     30 +char *uad = NULL;
     31 +char *config_file = NULL;		/* alternate configuration file */
     32  
     33  headers_t headers, *ht;
     34  
     35 @@ -261,7 +261,7 @@ char *strip_post_ws(char *str)
     36  
     37  	p = (str + strlen(str));
     38  	while(isspace(*--p)) {
     39 -		*p = (char)NULL;
     40 +		*p = '\0';
     41  	}
     42  
     43  	return(p);
     44 @@ -279,7 +279,7 @@ char *addr_parse(char *str)
     45  #endif
     46  
     47  	/* Simple case with email address enclosed in <> */
     48 -	if((p = strdup(str)) == (char *)NULL) {
     49 +	if((p = strdup(str)) == NULL) {
     50  		die("addr_parse(): strdup()");
     51  	}
     52  
     53 @@ -287,7 +287,7 @@ char *addr_parse(char *str)
     54  		q++;
     55  
     56  		if((p = strchr(q, '>'))) {
     57 -			*p = (char)NULL;
     58 +			*p = '\0';
     59  		}
     60  
     61  #if 0
     62 @@ -310,7 +310,7 @@ char *addr_parse(char *str)
     63  	q = strip_post_ws(p);
     64  	if(*q == ')') {
     65  		while((*--q != '('));
     66 -		*q = (char)NULL;
     67 +		*q = '\0';
     68  	}
     69  	(void)strip_post_ws(p);
     70  
     71 @@ -349,7 +349,6 @@ standardise() -- Trim off '\n's and doub
     72  */
     73  bool_t standardise(char *str, bool_t *linestart)
     74  {
     75 -	size_t sl;
     76  	char *p;
     77  	bool_t leadingdot = False;
     78  
     79 @@ -363,7 +362,7 @@ bool_t standardise(char *str, bool_t *li
     80  	*linestart = False;
     81  
     82  	if((p = strchr(str, '\n'))) {
     83 -		*p = (char)NULL;
     84 +		*p = '\0';
     85  		*linestart = True;
     86  	}
     87  	return(leadingdot);
     88 @@ -384,7 +383,7 @@ void revaliases(struct passwd *pw)
     89  		while(fgets(buf, sizeof(buf), fp)) {
     90  			/* Make comments invisible */
     91  			if((p = strchr(buf, '#'))) {
     92 -				*p = (char)NULL;
     93 +				*p = '\0';
     94  			}
     95  
     96  			/* Ignore malformed lines and comments */
     97 @@ -519,11 +518,11 @@ void rcpt_save(char *str)
     98  #endif
     99  
    100  	/* Ignore missing usernames */
    101 -	if(*str == (char)NULL) {
    102 +	if(*str == '\0') {
    103  		return;
    104  	}
    105  
    106 -	if((rt->string = strdup(str)) == (char *)NULL) {
    107 +	if((rt->string = strdup(str)) == NULL) {
    108  		die("rcpt_save() -- strdup() failed");
    109  	}
    110  
    111 @@ -548,7 +547,7 @@ void rcpt_parse(char *str)
    112  	(void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str);
    113  #endif
    114  
    115 -	if((p = strdup(str)) == (char *)NULL) {
    116 +	if((p = strdup(str)) == NULL) {
    117  		die("rcpt_parse(): strdup() failed");
    118  	}
    119  	q = p;
    120 @@ -576,7 +575,7 @@ void rcpt_parse(char *str)
    121  		}
    122  
    123  		/* End of string? */
    124 -		if(*(q + 1) == (char)NULL) {
    125 +		if(*(q + 1) == '\0') {
    126  			got_addr = True;
    127  		}
    128  
    129 @@ -584,7 +583,7 @@ void rcpt_parse(char *str)
    130  		if((*q == ',') && (in_quotes == False)) {
    131  			got_addr = True;
    132  
    133 -			*q = (char)NULL;
    134 +			*q = '\0';
    135  		}
    136  
    137  		if(got_addr) {
    138 @@ -668,7 +667,7 @@ void header_save(char *str)
    139  	(void)fprintf(stderr, "header_save(): str = [%s]\n", str);
    140  #endif
    141  
    142 -	if((p = strdup(str)) == (char *)NULL) {
    143 +	if((p = strdup(str)) == NULL) {
    144  		die("header_save() -- strdup() failed");
    145  	}
    146  	ht->string = p;
    147 @@ -676,7 +675,7 @@ void header_save(char *str)
    148  	if(strncasecmp(ht->string, "From:", 5) == 0) {
    149  #if 1
    150  		/* Hack check for NULL From: line */
    151 -		if(*(p + 6) == (char)NULL) {
    152 +		if(*(p + 6) == '\0') {
    153  			return;
    154  		}
    155  #endif
    156 @@ -739,19 +738,19 @@ header_parse() -- Break headers into sep
    157  void header_parse(FILE *stream)
    158  {
    159  	size_t size = BUF_SZ, len = 0;
    160 -	char *p = (char *)NULL, *q;
    161 +	char *p = NULL, *q;
    162  	bool_t in_header = True;
    163 -	char l = (char)NULL;
    164 +	char l = '\0';
    165  	int c;
    166  
    167  	while(in_header && ((c = fgetc(stream)) != EOF)) {
    168  		/* Must have space for up to two more characters, since we
    169  			may need to insert a '\r' */
    170 -		if((p == (char *)NULL) || (len >= (size - 1))) {
    171 +		if((p == NULL) || (len >= (size - 1))) {
    172  			size += BUF_SZ;
    173  
    174  			p = (char *)realloc(p, (size * sizeof(char)));
    175 -			if(p == (char *)NULL) {
    176 +			if(p == NULL) {
    177  				die("header_parse() -- realloc() failed");
    178  			}
    179  			q = (p + len);
    180 @@ -776,9 +775,9 @@ void header_parse(FILE *stream)
    181  						in_header = False;
    182  
    183  				default:
    184 -						*q = (char)NULL;
    185 +						*q = '\0';
    186  						if((q = strrchr(p, '\n'))) {
    187 -							*q = (char)NULL;
    188 +							*q = '\0';
    189  						}
    190  						header_save(p);
    191  
    192 @@ -809,9 +808,9 @@ void header_parse(FILE *stream)
    193  						in_header = False;
    194  
    195  				default:
    196 -						*q = (char)NULL;
    197 +						*q = '\0';
    198  						if((q = strrchr(p, '\n'))) {
    199 -							*q = (char)NULL;
    200 +							*q = '\0';
    201  						}
    202  						header_save(p);
    203  
    204 @@ -876,11 +875,11 @@ bool_t read_config()
    205  		char *rightside;
    206  		/* Make comments invisible */
    207  		if((p = strchr(buf, '#'))) {
    208 -			*p = (char)NULL;
    209 +			*p = '\0';
    210  		}
    211  
    212  		/* Ignore malformed lines and comments */
    213 -		if(strchr(buf, '=') == (char *)NULL) continue;
    214 +		if(strchr(buf, '=') == NULL) continue;
    215  
    216  		/* Parse out keywords */
    217  		p=firsttok(&begin, "= \t\n");
    218 @@ -890,7 +889,7 @@ bool_t read_config()
    219  		}
    220  		if(p && q) {
    221  			if(strcasecmp(p, "Root") == 0) {
    222 -				if((root = strdup(q)) == (char *)NULL) {
    223 +				if((root = strdup(q)) == NULL) {
    224  					die("parse_config() -- strdup() failed");
    225  				}
    226  
    227 @@ -904,7 +903,7 @@ bool_t read_config()
    228  					port = atoi(r);
    229  				}
    230  
    231 -				if((mailhost = strdup(q)) == (char *)NULL) {
    232 +				if((mailhost = strdup(q)) == NULL) {
    233  					die("parse_config() -- strdup() failed");
    234  				}
    235  
    236 @@ -949,7 +948,7 @@ bool_t read_config()
    237  					mail_domain = strdup(q);
    238  				}
    239  
    240 -				if(mail_domain == (char *)NULL) {
    241 +				if(mail_domain == NULL) {
    242  					die("parse_config() -- strdup() failed");
    243  				}
    244  				rewrite_domain = True;
    245 @@ -1025,7 +1024,7 @@ bool_t read_config()
    246  				}
    247  			}
    248  			else if(strcasecmp(p, "TLSCert") == 0) {
    249 -				if((tls_cert = strdup(q)) == (char *)NULL) {
    250 +				if((tls_cert = strdup(q)) == NULL) {
    251  					die("parse_config() -- strdup() failed");
    252  				}
    253  
    254 @@ -1036,7 +1035,7 @@ bool_t read_config()
    255  #endif
    256  			/* Command-line overrides these */
    257  			else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) {
    258 -				if((auth_user = strdup(q)) == (char *)NULL) {
    259 +				if((auth_user = strdup(q)) == NULL) {
    260  					die("parse_config() -- strdup() failed");
    261  				}
    262  
    263 @@ -1045,7 +1044,7 @@ bool_t read_config()
    264  				}
    265  			}
    266  			else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) {
    267 -				if((auth_pass = strdup(q)) == (char *)NULL) {
    268 +				if((auth_pass = strdup(q)) == NULL) {
    269  					die("parse_config() -- strdup() failed");
    270  				}
    271  
    272 @@ -1054,7 +1053,7 @@ bool_t read_config()
    273  				}
    274  			}
    275  			else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) {
    276 -				if((auth_method = strdup(q)) == (char *)NULL) {
    277 +				if((auth_method = strdup(q)) == NULL) {
    278  					die("parse_config() -- strdup() failed");
    279  				}
    280  
    281 @@ -1119,14 +1118,11 @@ int smtp_open(char *host, int port)
    282  	char buf[(BUF_SZ + 1)];
    283  
    284  	/* Init SSL stuff */
    285 -	SSL_CTX *ctx;
    286 -	SSL_METHOD *meth;
    287 +	SSL_CTX *ctx = NULL;
    288  	X509 *server_cert;
    289 -
    290  	SSL_load_error_strings();
    291  	SSLeay_add_ssl_algorithms();
    292 -	meth=SSLv23_client_method();
    293 -	ctx = SSL_CTX_new(meth);
    294 +	ctx = SSL_CTX_new(SSLv23_client_method());
    295  	if(!ctx) {
    296  		log_event(LOG_ERR, "No SSL support initiated\n");
    297  		return(-1);
    298 @@ -1310,7 +1306,7 @@ char *fd_gets(char *buf, int size, int f
    299  			buf[i++] = c;
    300  		}
    301  	}
    302 -	buf[i] = (char)NULL;
    303 +	buf[i] = '\0';
    304  
    305  	return(buf);
    306  }
    307 @@ -1434,14 +1430,14 @@ int ssmtp(char *argv[])
    308  	}
    309  
    310  	if((p = strtok(pw->pw_gecos, ";,"))) {
    311 -		if((gecos = strdup(p)) == (char *)NULL) {
    312 +		if((gecos = strdup(p)) == NULL) {
    313  			die("ssmtp() -- strdup() failed");
    314  		}
    315  	}
    316  	revaliases(pw);
    317  
    318  	/* revaliases() may have defined this */
    319 -	if(uad == (char *)NULL) {
    320 +	if(uad == NULL) {
    321  		uad = append_domain(pw->pw_name);
    322  	}
    323  
    324 @@ -1489,7 +1485,7 @@ int ssmtp(char *argv[])
    325  	/* Try to log in if username was supplied */
    326  	if(auth_user) {
    327  #ifdef MD5AUTH
    328 -		if(auth_pass == (char *)NULL) {
    329 +		if(auth_pass == NULL) {
    330  			auth_pass = strdup("");
    331  		}
    332  
    333 @@ -1508,7 +1504,7 @@ int ssmtp(char *argv[])
    334  		else {
    335  #endif
    336  		memset(buf, 0, bufsize);
    337 -		to64frombits(buf, auth_user, strlen(auth_user));
    338 +		to64frombits(buf, (unsigned char *)auth_user, strlen(auth_user));
    339  		if (use_oldauth) {
    340  			outbytes += smtp_write(sock, "AUTH LOGIN %s", buf);
    341  		}
    342 @@ -1520,7 +1516,7 @@ int ssmtp(char *argv[])
    343  			}
    344  			/* we assume server asked us for Username */
    345  			memset(buf, 0, bufsize);
    346 -			to64frombits(buf, auth_user, strlen(auth_user));
    347 +			to64frombits(buf, (unsigned char *)auth_user, strlen(auth_user));
    348  			outbytes += smtp_write(sock, buf);
    349  		}
    350  
    351 @@ -1530,7 +1526,7 @@ int ssmtp(char *argv[])
    352  		}
    353  		memset(buf, 0, bufsize);
    354  
    355 -		to64frombits(buf, auth_pass, strlen(auth_pass));
    356 +		to64frombits(buf, (unsigned char *)auth_pass, strlen(auth_pass));
    357  #ifdef MD5AUTH
    358  		}
    359  #endif
    360 @@ -1737,7 +1733,7 @@ char **parse_options(int argc, char *arg
    361  		j = 0;
    362  
    363  		add = 1;
    364 -		while(argv[i][++j] != (char)NULL) {
    365 +		while(argv[i][++j] != '\0') {
    366  			switch(argv[i][j]) {
    367  #ifdef INET6
    368  			case '6':
    369 @@ -1755,14 +1751,14 @@ char **parse_options(int argc, char *arg
    370  					if((!argv[i][(j + 1)])
    371  						&& argv[(i + 1)]) {
    372  						auth_user = strdup(argv[i+1]);
    373 -						if(auth_user == (char *)NULL) {
    374 +						if(auth_user == NULL) {
    375  							die("parse_options() -- strdup() failed");
    376  						}
    377  						add++;
    378  					}
    379  					else {
    380  						auth_user = strdup(argv[i]+j+1);
    381 -						if(auth_user == (char *)NULL) {
    382 +						if(auth_user == NULL) {
    383  							die("parse_options() -- strdup() failed");
    384  						}
    385  					}
    386 @@ -1772,14 +1768,14 @@ char **parse_options(int argc, char *arg
    387  					if((!argv[i][(j + 1)])
    388  						&& argv[(i + 1)]) {
    389  						auth_pass = strdup(argv[i+1]);
    390 -						if(auth_pass == (char *)NULL) {
    391 +						if(auth_pass == NULL) {
    392  							die("parse_options() -- strdup() failed");
    393  						}
    394  						add++;
    395  					}
    396  					else {
    397  						auth_pass = strdup(argv[i]+j+1);
    398 -						if(auth_pass == (char *)NULL) {
    399 +						if(auth_pass == NULL) {
    400  							die("parse_options() -- strdup() failed");
    401  						}
    402  					}
    403 @@ -1870,14 +1866,14 @@ char **parse_options(int argc, char *arg
    404  			case 'F':
    405  				if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
    406  					minus_F = strdup(argv[(i + 1)]);
    407 -					if(minus_F == (char *)NULL) {
    408 +					if(minus_F == NULL) {
    409  						die("parse_options() -- strdup() failed");
    410  					}
    411  					add++;
    412  				}
    413  				else {
    414  					minus_F = strdup(argv[i]+j+1);
    415 -					if(minus_F == (char *)NULL) {
    416 +					if(minus_F == NULL) {
    417  						die("parse_options() -- strdup() failed");
    418  					}
    419  				}
    420 @@ -1889,14 +1885,14 @@ char **parse_options(int argc, char *arg
    421  			case 'r':
    422  				if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
    423  					minus_f = strdup(argv[(i + 1)]);
    424 -					if(minus_f == (char *)NULL) {
    425 +					if(minus_f == NULL) {
    426  						die("parse_options() -- strdup() failed");
    427  					}
    428  					add++;
    429  				}
    430  				else {
    431  					minus_f = strdup(argv[i]+j+1);
    432 -					if(minus_f == (char *)NULL) {
    433 +					if(minus_f == NULL) {
    434  						die("parse_options() -- strdup() failed");
    435  					}
    436  				}
    437 --- a/base64.c
    438 +++ b/base64.c
    439 @@ -31,7 +31,7 @@ static const char base64val[] = {
    440  };
    441  #define DECODE64(c)  (isascii(c) ? base64val[c] : BAD)
    442  
    443 -void to64frombits(unsigned char *out, const unsigned char *in, int inlen)
    444 +void to64frombits(char *out, const unsigned char *in, int inlen)
    445  /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
    446  {
    447      for (; inlen >= 3; inlen -= 3)
    448 @@ -57,7 +57,7 @@ void to64frombits(unsigned char *out, co
    449      *out = '\0';
    450  }
    451  
    452 -int from64tobits(char *out, const char *in)
    453 +int from64tobits(unsigned char *out, const char *in)
    454  /* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */
    455  {
    456      int len = 0;
    457 --- a/ssmtp.h
    458 +++ b/ssmtp.h
    459 @@ -41,5 +41,5 @@ typedef struct string_list rcpt_t;
    460  void get_arpadate(char *);
    461  
    462  /* base64.c */
    463 -void to64frombits(unsigned char *, const unsigned char *, int);
    464 -int from64tobits(char *, const char *);
    465 +void to64frombits(char *, const unsigned char *, int);
    466 +int from64tobits(unsigned char *, const char *);