1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
|
From 8bb2a1b719c6538589897e3d409a0d2362a8a8b9 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcritten@redhat.com>
Date: Tue, 21 Jan 2025 13:51:24 -0500
Subject: [PATCH] Add compatibility for gcc 15
Fedora 42 is going to use gcc 15 which changes some warnings into errors. Address the issues raised.
The issues addressed include:
* The RETURN macro is defined differently in two places. Rename one.
* Both atexit and the sigint and sigterm actions call server_exit().
The function arguments differ. Introduce a new generic signal handler
to call server_exit() for sigint and sigterm signals.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2340025
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
---
lib/auxprop.c | 2 +-
lib/canonusr.c | 6 ++--
lib/client.c | 6 ++--
lib/common.c | 40 ++++++++++++-------------
lib/md5.c | 48 +++++++++---------------------
lib/saslint.h | 8 ++---
lib/server.c | 32 ++++++++++----------
saslauthd/auth_sasldb.c | 4 +--
saslauthd/md5.c | 60 ++++++++++++--------------------------
saslauthd/saslauthd-main.c | 12 +++++---
saslauthd/saslauthd-main.h | 5 ++--
saslauthd/saslauthd_md5.h | 9 +++---
12 files changed, 95 insertions(+), 137 deletions(-)
--- a/lib/auxprop.c
+++ b/lib/auxprop.c
@@ -780,7 +780,7 @@ int sasl_auxprop_request(sasl_conn_t *co
}
result = prop_request(sconn->sparams->propctx, propnames);
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
--- a/lib/canonusr.c
+++ b/lib/canonusr.c
@@ -192,7 +192,7 @@ int _sasl_canon_user(sasl_conn_t *conn,
oparams->user = conn->user_buf;
}
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* Lookup all properties for authentication and/or authorization identity. */
@@ -256,7 +256,7 @@ static int _sasl_auxprop_lookup_user_pro
}
#endif
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* default behavior:
@@ -285,7 +285,7 @@ int _sasl_canon_user_lookup (sasl_conn_t
oparams);
}
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
void _sasl_canonuser_free()
--- a/lib/client.c
+++ b/lib/client.c
@@ -435,7 +435,7 @@ int sasl_client_new(const char *service,
&client_idle, serverFQDN,
iplocalport, ipremoteport,
prompt_supp, &global_callbacks_client);
- if (result != SASL_OK) RETURN(*pconn, result);
+ if (result != SASL_OK) RETURN_VAL(*pconn, result);
utils = _sasl_alloc_utils(*pconn, &global_callbacks_client);
if (utils == NULL) {
@@ -879,7 +879,7 @@ int sasl_client_start(sasl_conn_t *conn,
done:
if (ordered_mechs != NULL)
c_conn->cparams->utils->free(ordered_mechs);
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* do a single authentication step.
@@ -952,7 +952,7 @@ int sasl_client_step(sasl_conn_t *conn,
}
}
- RETURN(conn,result);
+ RETURN_VAL(conn,result);
}
/* returns the length of all the mechanisms
--- a/lib/common.c
+++ b/lib/common.c
@@ -303,7 +303,7 @@ int sasl_encode(sasl_conn_t *conn, const
result = sasl_encodev(conn, &tmp, 1, output, outputlen);
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* Internal function that doesn't do any verification */
@@ -389,7 +389,7 @@ _sasl_encodev (sasl_conn_t *conn,
(*p_num_packets)++;
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* security-encode an iovec */
@@ -434,7 +434,7 @@ int sasl_encodev(sasl_conn_t *conn,
*output = conn->encode_buf->data;
*outputlen = (unsigned) conn->encode_buf->curlen;
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* This might be better to check on a per-plugin basis, but I think
@@ -592,7 +592,7 @@ cleanup:
sasl_FREE(cur_invec);
}
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* output is only valid until next call to sasl_decode */
@@ -609,7 +609,7 @@ int sasl_decode(sasl_conn_t *conn,
if(!conn->props.maxbufsize) {
sasl_seterror(conn, 0,
"called sasl_decode with application that does not support security layers");
- RETURN(conn, SASL_TOOWEAK);
+ RETURN_VAL(conn, SASL_TOOWEAK);
}
if(conn->oparams.decode == NULL)
@@ -623,7 +623,7 @@ int sasl_decode(sasl_conn_t *conn,
if(inputlen > conn->props.maxbufsize) {
sasl_seterror(conn, 0,
"input too large for default sasl_decode");
- RETURN(conn,SASL_BUFOVER);
+ RETURN_VAL(conn,SASL_BUFOVER);
}
if(!conn->decode_buf)
@@ -644,7 +644,7 @@ int sasl_decode(sasl_conn_t *conn,
/* NULL an empty buffer (for misbehaved applications) */
if (*outputlen == 0) *output = NULL;
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
INTERROR(conn, SASL_FAIL);
@@ -738,11 +738,11 @@ int _sasl_conn_init(sasl_conn_t *conn,
result = sasl_setprop(conn, SASL_IPLOCALPORT, iplocalport);
if(result != SASL_OK)
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
result = sasl_setprop(conn, SASL_IPREMOTEPORT, ipremoteport);
if(result != SASL_OK)
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
conn->encode_buf = NULL;
conn->context = NULL;
@@ -787,7 +787,7 @@ int _sasl_conn_init(sasl_conn_t *conn,
if(result != SASL_OK) MEMERROR( conn );
- RETURN(conn, SASL_OK);
+ RETURN_VAL(conn, SASL_OK);
}
int _sasl_common_init(sasl_global_callbacks_t *global_callbacks)
@@ -1068,11 +1068,11 @@ int sasl_getprop(sasl_conn_t *conn, int
} else if(result == SASL_NOTDONE) {
sasl_seterror(conn, SASL_NOLOG,
"Information that was requested is not yet available.");
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
} else if(result != SASL_OK) {
INTERROR(conn, result);
} else
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* set property in SASL connection state
@@ -1146,7 +1146,7 @@ int sasl_setprop(sasl_conn_t *conn, int
if(props->maxbufsize == 0 && props->min_ssf != 0) {
sasl_seterror(conn, 0,
"Attempt to disable security layers (maxoutbuf == 0) with min_ssf > 0");
- RETURN(conn, SASL_TOOWEAK);
+ RETURN_VAL(conn, SASL_TOOWEAK);
}
conn->props = *props;
@@ -1168,7 +1168,7 @@ int sasl_setprop(sasl_conn_t *conn, int
} else if (_sasl_ipfromstring(ipremoteport, NULL, 0)
!= SASL_OK) {
sasl_seterror(conn, 0, "Bad IPREMOTEPORT value");
- RETURN(conn, SASL_BADPARAM);
+ RETURN_VAL(conn, SASL_BADPARAM);
} else {
strcpy(conn->ipremoteport, ipremoteport);
conn->got_ip_remote = 1;
@@ -1209,7 +1209,7 @@ int sasl_setprop(sasl_conn_t *conn, int
} else if (_sasl_ipfromstring(iplocalport, NULL, 0)
!= SASL_OK) {
sasl_seterror(conn, 0, "Bad IPLOCALPORT value");
- RETURN(conn, SASL_BADPARAM);
+ RETURN_VAL(conn, SASL_BADPARAM);
} else {
strcpy(conn->iplocalport, iplocalport);
conn->got_ip_local = 1;
@@ -1302,7 +1302,7 @@ int sasl_setprop(sasl_conn_t *conn, int
result = SASL_BADPARAM;
}
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* this is apparently no longer a user function */
@@ -1708,7 +1708,7 @@ _sasl_proxy_policy(sasl_conn_t *conn,
(memcmp(auth_identity, requested_user, rlen) != 0)) {
sasl_seterror(conn, 0,
"Requested identity not authenticated identity");
- RETURN(conn, SASL_BADAUTH);
+ RETURN_VAL(conn, SASL_BADAUTH);
}
return SASL_OK;
@@ -1809,7 +1809,7 @@ int _sasl_getcallback(sasl_conn_t * conn
*pproc = NULL;
*pcontext = NULL;
sasl_seterror(conn, SASL_NOLOG, "Unable to find a callback: %d", callbackid);
- RETURN(conn,SASL_FAIL);
+ RETURN_VAL(conn,SASL_FAIL);
}
@@ -2405,10 +2405,10 @@ int sasl_listmech(sasl_conn_t *conn,
if(!conn) {
return SASL_BADPARAM;
} else if(conn->type == SASL_CONN_SERVER) {
- RETURN(conn, _sasl_server_listmech(conn, user, prefix, sep, suffix,
+ RETURN_VAL(conn, _sasl_server_listmech(conn, user, prefix, sep, suffix,
result, plen, pcount));
} else if (conn->type == SASL_CONN_CLIENT) {
- RETURN(conn, _sasl_client_listmech(conn, prefix, sep, suffix,
+ RETURN_VAL(conn, _sasl_client_listmech(conn, prefix, sep, suffix,
result, plen, pcount));
}
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -54,13 +54,11 @@ documentation and/or software.
#define S43 15
#define S44 21
-static void MD5Transform PROTO_LIST ((UINT4 [4], const unsigned char [64]));
-static void Encode PROTO_LIST
- ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
- ((UINT4 *, const unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
+static void MD5Transform (UINT4 [4], const unsigned char [64]);
+static void Encode (unsigned char *, UINT4 *, unsigned int);
+static void Decode (UINT4 *, const unsigned char *, unsigned int);
+static void MD5_memcpy (POINTER, POINTER, unsigned int);
+static void MD5_memset (POINTER, int, unsigned int);
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -98,8 +96,7 @@ Rotation is separate from addition to pr
/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
-void _sasl_MD5Init (context)
-MD5_CTX *context; /* context */
+void _sasl_MD5Init (MD5_CTX *context)
{
context->count[0] = context->count[1] = 0;
@@ -114,10 +111,7 @@ MD5_CTX *context; /* context */
operation, processing another message block, and updating the context.
*/
-void _sasl_MD5Update (context, input, inputLen)
-MD5_CTX *context; /* context */
-const unsigned char *input; /* input block */
-unsigned int inputLen; /* length of input block */
+void _sasl_MD5Update (MD5_CTX *context, const unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
@@ -159,9 +153,7 @@ unsigned int inputLen; /* length of inpu
the message digest and zeroizing the context.
*/
-void _sasl_MD5Final (digest, context)
-unsigned char digest[16]; /* message digest */
-MD5_CTX *context; /* context */
+void _sasl_MD5Final (unsigned char digest[16], MD5_CTX *context)
{
unsigned char bits[8];
unsigned int index, padLen;
@@ -186,9 +178,7 @@ MD5_CTX *context; /* context */
/* MD5 basic transformation. Transforms state based on block. */
-static void MD5Transform (state, block)
-UINT4 state[4];
-const unsigned char block[64];
+static void MD5Transform (UINT4 state[4], const unsigned char block[64])
{
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
@@ -281,10 +271,7 @@ const unsigned char block[64];
*/
-static void Encode (output, input, len)
-unsigned char *output;
-UINT4 *input;
-unsigned int len;
+static void Encode (unsigned char *output, UINT4 *input, unsigned int len)
{
unsigned int i, j;
@@ -301,10 +288,7 @@ unsigned int len;
*/
-static void Decode (output, input, len)
-UINT4 *output;
-const unsigned char *input;
-unsigned int len;
+static void Decode (UINT4 *output, const unsigned char *input, unsigned int len)
{
unsigned int i, j;
@@ -317,10 +301,7 @@ unsigned int len;
*/
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
+static void MD5_memcpy (POINTER output, POINTER input, unsigned int len)
{
unsigned int i;
@@ -331,10 +312,7 @@ unsigned int len;
/* Note: Replace "for loop" with standard memset if possible.
*/
-static void MD5_memset (output, value, len)
-POINTER output;
-int value;
-unsigned int len;
+static void MD5_memset (POINTER output, int value, unsigned int len)
{
unsigned int i;
--- a/lib/saslint.h
+++ b/lib/saslint.h
@@ -74,22 +74,22 @@
* memory errors.
* -Only errors (error codes < SASL_OK) should be remembered
*/
-#define RETURN(conn, val) { if(conn && (val) < SASL_OK) \
+#define RETURN_VAL(conn, val) { if(conn && (val) < SASL_OK) \
(conn)->error_code = (val); \
return (val); }
#define MEMERROR(conn) {\
if(conn) sasl_seterror( (conn), 0, \
"Out of Memory in " __FILE__ " near line %d", __LINE__ ); \
- RETURN(conn, SASL_NOMEM) }
+ RETURN_VAL(conn, SASL_NOMEM) }
#define PARAMERROR(conn) {\
if(conn) sasl_seterror( (conn), SASL_NOLOG, \
"Parameter error in " __FILE__ " near line %d", __LINE__ ); \
- RETURN(conn, SASL_BADPARAM) }
+ RETURN_VAL(conn, SASL_BADPARAM) }
#define INTERROR(conn, val) {\
if(conn) sasl_seterror( (conn), 0, \
"Internal Error %d in " __FILE__ " near line %d", (val),\
__LINE__ ); \
- RETURN(conn, (val)) }
+ RETURN_VAL(conn, (val)) }
#ifndef PATH_MAX
# ifdef WIN32
--- a/lib/server.c
+++ b/lib/server.c
@@ -155,7 +155,7 @@ int sasl_setpass(sasl_conn_t *conn,
(current_mech == NULL) ) {
sasl_seterror( conn, SASL_NOLOG,
"No current SASL mechanism available");
- RETURN(conn, SASL_BADPARAM);
+ RETURN_VAL(conn, SASL_BADPARAM);
}
/* Do we want to store SASL_AUX_PASSWORD_PROP (plain text)? and
@@ -297,7 +297,7 @@ int sasl_setpass(sasl_conn_t *conn,
}
}
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* local mechanism which disposes of server */
@@ -991,7 +991,7 @@ _sasl_transition(sasl_conn_t * conn,
NULL, 0, SASL_SET_CREATE | flags);
}
- RETURN(conn,result);
+ RETURN_VAL(conn,result);
}
@@ -1367,7 +1367,7 @@ static int do_authorization(sasl_server_
(s_conn->user_realm ? (unsigned) strlen(s_conn->user_realm) : 0),
s_conn->sparams->propctx);
- RETURN(&s_conn->base, ret);
+ RETURN_VAL(&s_conn->base, ret);
}
@@ -1484,7 +1484,7 @@ int sasl_server_start(sasl_conn_t *conn,
if (result != SASL_OK) {
/* The library will eventually be freed, don't sweat it */
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
}
@@ -1573,7 +1573,7 @@ int sasl_server_start(sasl_conn_t *conn,
conn->oparams.doneflag = 0;
}
- RETURN(conn,result);
+ RETURN_VAL(conn,result);
}
@@ -1701,7 +1701,7 @@ int sasl_server_step(sasl_conn_t *conn,
conn->oparams.doneflag = 0;
}
- RETURN(conn, ret);
+ RETURN_VAL(conn, ret);
}
/* returns the length of all the mechanisms
@@ -1950,7 +1950,7 @@ static int _sasl_checkpass(sasl_conn_t *
if (result != SASL_OK)
sasl_seterror(conn, SASL_NOLOG, "checkpass failed");
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* check if a plaintext password is valid
@@ -1990,7 +1990,7 @@ int sasl_checkpass(sasl_conn_t *conn,
result = _sasl_canon_user(conn, user, userlen,
SASL_CU_AUTHID | SASL_CU_AUTHZID,
&(conn->oparams));
- if(result != SASL_OK) RETURN(conn, result);
+ if(result != SASL_OK) RETURN_VAL(conn, result);
user = conn->oparams.user;
/* Check the password and lookup additional properties */
@@ -2001,7 +2001,7 @@ int sasl_checkpass(sasl_conn_t *conn,
result = do_authorization((sasl_server_conn_t *)conn);
}
- RETURN(conn,result);
+ RETURN_VAL(conn,result);
}
/* check if a user exists on server
@@ -2074,7 +2074,7 @@ int sasl_user_exists(sasl_conn_t *conn,
sasl_seterror(conn, SASL_NOLOG, "no plaintext password verifier?");
}
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* check if an apop exchange is valid
@@ -2136,7 +2136,7 @@ int sasl_checkapop(sasl_conn_t *conn,
if (!user_end || strspn(user_end + 1, "0123456789abcdef") != 32)
{
sasl_seterror(conn, 0, "Bad Digest");
- RETURN(conn,SASL_BADPROT);
+ RETURN_VAL(conn,SASL_BADPROT);
}
user_len = (size_t)(user_end - response);
@@ -2148,7 +2148,7 @@ int sasl_checkapop(sasl_conn_t *conn,
if(result != SASL_OK)
{
sasl_FREE(user);
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
}
/* erase the plaintext password */
@@ -2163,7 +2163,7 @@ int sasl_checkapop(sasl_conn_t *conn,
&(conn->oparams));
sasl_FREE(user);
- if(result != SASL_OK) RETURN(conn, result);
+ if(result != SASL_OK) RETURN_VAL(conn, result);
/* Do APOP verification */
result = _sasl_auxprop_verify_apop(conn, conn->oparams.authid,
@@ -2178,11 +2178,11 @@ int sasl_checkapop(sasl_conn_t *conn,
conn->oparams.authid = NULL;
}
- RETURN(conn, result);
+ RETURN_VAL(conn, result);
#else /* sasl_checkapop was disabled at compile time */
sasl_seterror(conn, SASL_NOLOG,
"sasl_checkapop called, but was disabled at compile time");
- RETURN(conn, SASL_NOMECH);
+ RETURN_VAL(conn, SASL_NOMECH);
#endif /* DO_SASL_CHECKAPOP */
}
--- a/saslauthd/auth_sasldb.c
+++ b/saslauthd/auth_sasldb.c
@@ -51,9 +51,7 @@
#include "../sasldb/sasldb.h"
static int
-vf(void *context __attribute__((unused)),
- char *file __attribute__((unused)),
- int type __attribute__((unused)))
+vf(void)
{
/* always say ok */
return SASL_OK;
--- a/saslauthd/md5.c
+++ b/saslauthd/md5.c
@@ -54,13 +54,11 @@ documentation and/or software.
#define S43 15
#define S44 21
-static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
-static void Encode PROTO_LIST
- ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
- ((UINT4 *, unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
+static void MD5Transform (UINT4 [4], unsigned char [64]);
+static void Encode (unsigned char *, UINT4 *, unsigned int);
+static void Decode (UINT4 *, unsigned char *, unsigned int);
+static void MD5_memcpy (POINTER, POINTER, unsigned int);
+static void MD5_memset (POINTER, int, unsigned int);
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -98,8 +96,7 @@ Rotation is separate from addition to pr
/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
-void _saslauthd_MD5Init (context)
-MD5_CTX *context; /* context */
+void _saslauthd_MD5Init (MD5_CTX *context)
{
context->count[0] = context->count[1] = 0;
@@ -114,10 +111,7 @@ MD5_CTX *context; /* context */
operation, processing another message block, and updating the context.
*/
-void _saslauthd_MD5Update (context, input, inputLen)
-MD5_CTX *context; /* context */
-unsigned char *input; /* input block */
-unsigned int inputLen; /* length of input block */
+void _saslauthd_MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen)
{
unsigned int i, index, partLen;
@@ -159,9 +153,7 @@ unsigned int inputLen; /* length of inpu
the message digest and zeroizing the context.
*/
-void _saslauthd_MD5Final (digest, context)
-unsigned char digest[16]; /* message digest */
-MD5_CTX *context; /* context */
+void _saslauthd_MD5Final (unsigned char digest[16], MD5_CTX *context)
{
unsigned char bits[8];
unsigned int index, padLen;
@@ -186,9 +178,7 @@ MD5_CTX *context; /* context */
/* MD5 basic transformation. Transforms state based on block. */
-static void MD5Transform (state, block)
-UINT4 state[4];
-unsigned char block[64];
+static void MD5Transform (UINT4 state[4], unsigned char block[64])
{
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
@@ -281,10 +271,7 @@ unsigned char block[64];
*/
-static void Encode (output, input, len)
-unsigned char *output;
-UINT4 *input;
-unsigned int len;
+static void Encode (unsigned char *output, UINT4 *input, unsigned int len)
{
unsigned int i, j;
@@ -301,10 +288,7 @@ unsigned int len;
*/
-static void Decode (output, input, len)
-UINT4 *output;
-unsigned char *input;
-unsigned int len;
+static void Decode (UINT4 *output, unsigned char *input, unsigned int len)
{
unsigned int i, j;
@@ -317,10 +301,7 @@ unsigned int len;
*/
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
+static void MD5_memcpy (POINTER output, POINTER input, unsigned int len)
{
unsigned int i;
@@ -331,10 +312,7 @@ unsigned int len;
/* Note: Replace "for loop" with standard memset if possible.
*/
-static void MD5_memset (output, value, len)
-POINTER output;
-int value;
-unsigned int len;
+static void MD5_memset (POINTER output, int value, unsigned int len)
{
unsigned int i;
@@ -360,7 +338,7 @@ void _saslauthd_hmac_md5_init(HMAC_MD5_C
MD5_CTX tctx;
_saslauthd_MD5Init(&tctx);
- _saslauthd_MD5Update(&tctx, key, key_len);
+ _saslauthd_MD5Update(&tctx, (unsigned char *)key, key_len);
_saslauthd_MD5Final(tk, &tctx);
key = tk;
@@ -397,9 +375,9 @@ void _saslauthd_hmac_md5_init(HMAC_MD5_C
_saslauthd_MD5Update(&hmac->octx, k_opad, 64); /* apply outer pad */
/* scrub the pads and key context (if used) */
- MD5_memset(&k_ipad, 0, sizeof(k_ipad));
- MD5_memset(&k_opad, 0, sizeof(k_opad));
- MD5_memset(&tk, 0, sizeof(tk));
+ MD5_memset((POINTER)&k_ipad, 0, sizeof(k_ipad));
+ MD5_memset((POINTER)&k_opad, 0, sizeof(k_opad));
+ MD5_memset((POINTER)&tk, 0, sizeof(tk));
/* and we're done. */
}
@@ -424,7 +402,7 @@ void _saslauthd_hmac_md5_precalc(HMAC_MD
state->istate[lupe] = htonl(hmac.ictx.state[lupe]);
state->ostate[lupe] = htonl(hmac.octx.state[lupe]);
}
- MD5_memset(&hmac, 0, sizeof(hmac));
+ MD5_memset((POINTER)&hmac, 0, sizeof(hmac));
}
@@ -432,7 +410,7 @@ void _saslauthd_hmac_md5_import(HMAC_MD5
HMAC_MD5_STATE *state)
{
unsigned lupe;
- MD5_memset(hmac, 0, sizeof(HMAC_MD5_CTX));
+ MD5_memset((POINTER)hmac, 0, sizeof(HMAC_MD5_CTX));
for (lupe = 0; lupe < 4; lupe++) {
hmac->ictx.state[lupe] = ntohl(state->istate[lupe]);
hmac->octx.state[lupe] = ntohl(state->ostate[lupe]);
--- a/saslauthd/saslauthd-main.c
+++ b/saslauthd/saslauthd-main.c
@@ -593,7 +593,7 @@ void signal_setup() {
/**************************************************************
* Handler for SIGTERM
**************************************************************/
- act_sigterm.sa_handler = server_exit;
+ act_sigterm.sa_handler = handle_exit;
sigemptyset(&act_sigterm.sa_mask);
if (sigaction(SIGTERM, &act_sigterm, NULL) != 0) {
@@ -606,7 +606,7 @@ void signal_setup() {
/**************************************************************
* Handler for SIGINT
**************************************************************/
- act_sigint.sa_handler = server_exit;
+ act_sigint.sa_handler = handle_exit;
sigemptyset(&act_sigint.sa_mask);
if (sigaction(SIGINT, &act_sigint, NULL) != 0) {
@@ -876,7 +876,7 @@ pid_t have_baby() {
/*************************************************************
* Reap in all the dead children
**************************************************************/
-void handle_sigchld() {
+void handle_sigchld(__attribute__((unused)) int sig) {
pid_t pid;
while ((pid = waitpid(-1, 0, WNOHANG)) > 0) {
@@ -888,11 +888,15 @@ void handle_sigchld() {
return;
}
+void handle_exit(__attribute__((unused)) int sig) {
+ server_exit();
+}
+
/*************************************************************
* Do some final cleanup here.
**************************************************************/
-void server_exit() {
+void server_exit(void) {
/*********************************************************
* If we're not the master process, don't do anything
--- a/saslauthd/saslauthd-main.h
+++ b/saslauthd/saslauthd-main.h
@@ -96,8 +96,9 @@ extern void set_mech_option(const char *
extern void set_run_path(const char *);
extern void signal_setup();
extern void detach_tty();
-extern void handle_sigchld();
-extern void server_exit();
+extern void handle_sigchld(int sig);
+extern void handle_exit(int sig);
+extern void server_exit(void);
extern pid_t have_baby();
/* ipc api delcarations */
--- a/saslauthd/saslauthd_md5.h
+++ b/saslauthd/saslauthd_md5.h
@@ -29,9 +29,8 @@ typedef struct {
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
-void _saslauthd_MD5Init PROTO_LIST ((MD5_CTX *));
-void _saslauthd_MD5Update PROTO_LIST
- ((MD5_CTX *, unsigned char *, unsigned int));
-void _saslauthd_MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
+void _saslauthd_MD5Init (MD5_CTX *);
+void _saslauthd_MD5Update (MD5_CTX *, unsigned char *, unsigned int);
+void _saslauthd_MD5Final (unsigned char [16], MD5_CTX *);
-void _saslauthd_hmac_md5 PROTO_LIST ((unsigned char *, int, unsigned char *, int, caddr_t));
+void _saslauthd_hmac_md5 (unsigned char *, int, unsigned char *, int, caddr_t);
|