summaryrefslogtreecommitdiff
path: root/README.cbcp
blob: 8521021d50118f8baa20329d080c69d431b23be0 (plain)
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
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
	     Microsoft Call Back Configuration Protocol.
			by Pedro Roque Marques

The CBCP is a method by which the Microsoft Windows NT Server may
implement additional security. It is possible to configure the server
in such a manner so as to require that the client systems which
connect with it are required that following a valid authentication to
leave a method by which the number may be returned call.

It is a requirement of servers so configured that the protocol be
exchanged.

So, this set of patches may be applied to the pppd process to enable
the cbcp client *only* portion of the specification. It is primarily
meant to permit connection with Windows NT Servers.

The ietf-working specification may be obtained from ftp.microsoft.com
in the developr/rfc directory.

The ietf task group has decided to recommend that the LCP sequence be
extended to permit the callback operation. For this reason, these
patches are not 'part' of pppd but are an adjunct to the code. I
hopefully have included enough of the context to permit the patch
program so that minor changes to the program should not effect the
patch by more than a few lines in the 'fuzz' factor.



diff -r --unified=10 ppp-2.2a5.orig/linux/ppp_defs.h ppp-2.2a5/linux/ppp_defs.h
--- ppp-2.2a5.orig/linux/ppp_defs.h	Sat May 13 12:38:19 1995
+++ ppp-2.2a5/linux/ppp_defs.h	Sat May 13 13:46:36 1995
@@ -56,20 +56,21 @@
 #define PPP_IP		0x21	/* Internet Protocol */
 #define	PPP_VJC_COMP	0x2d	/* VJ compressed TCP */
 #define	PPP_VJC_UNCOMP	0x2f	/* VJ uncompressed TCP */
 #define PPP_COMP	0xfd	/* compressed packet */
 #define PPP_IPCP	0x8021	/* IP Control Protocol */
 #define PPP_CCP		0x80fd	/* Compression Control Protocol */
 #define PPP_LCP		0xc021	/* Link Control Protocol */
 #define PPP_PAP		0xc023	/* Password Authentication Protocol */
 #define PPP_LQR		0xc025	/* Link Quality Report protocol */
 #define PPP_CHAP	0xc223	/* Cryptographic Handshake Auth. Protocol */
+#define PPP_CBCP        0xc029  /* Callback Control Protocol */
 
 /*
  * Values for FCS calculations.
  */
 #define PPP_INITFCS	0xffff	/* Initial FCS value */
 #define PPP_GOODFCS	0xf0b8	/* Good final FCS value */
 #define PPP_FCS(fcs, c)	(((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
 
 /*
  * A 32-bit unsigned integral type.
diff -r --unified=10 ppp-2.2a5.orig/net/ppp_defs.h ppp-2.2a5/net/ppp_defs.h
--- ppp-2.2a5.orig/net/ppp_defs.h	Sat May 13 12:38:19 1995
+++ ppp-2.2a5/net/ppp_defs.h	Sat May 13 13:57:14 1995
@@ -56,20 +56,21 @@
 #define PPP_IP		0x21	/* Internet Protocol */
 #define	PPP_VJC_COMP	0x2d	/* VJ compressed TCP */
 #define	PPP_VJC_UNCOMP	0x2f	/* VJ uncompressed TCP */
 #define PPP_COMP	0xfd	/* compressed packet */
 #define PPP_IPCP	0x8021	/* IP Control Protocol */
 #define PPP_CCP		0x80fd	/* Compression Control Protocol */
 #define PPP_LCP		0xc021	/* Link Control Protocol */
 #define PPP_PAP		0xc023	/* Password Authentication Protocol */
 #define PPP_LQR		0xc025	/* Link Quality Report protocol */
 #define PPP_CHAP	0xc223	/* Cryptographic Handshake Auth. Protocol */
+#define PPP_CBCP        0xc029  /* Callback Control Protocol */
 
 /*
  * Values for FCS calculations.
  */
 #define PPP_INITFCS	0xffff	/* Initial FCS value */
 #define PPP_GOODFCS	0xf0b8	/* Good final FCS value */
 #define PPP_FCS(fcs, c)	(((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
 
 /*
  * A 32-bit unsigned integral type.
diff -r --unified=10 ppp-2.2a5.orig/pppd/Makefile.aix4 ppp-2.2a5/pppd/Makefile.aix4
--- ppp-2.2a5.orig/pppd/Makefile.aix4	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/Makefile.aix4	Sat May 13 14:09:17 1995
@@ -3,26 +3,26 @@
 # $Id: README.cbcp,v 1.1 1997/04/30 05:37:27 paulus Exp $
 #
 #ifndef BINDIR
 BINDIR = /usr/sbin
 #endif
 #ifndef MANDIR
 MANDIR = /usr/man
 #ENDIF
 
 PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c \
-	auth.c options.c sys-bsd.c sys-str.c sys-aix4.c ccp.c
-HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h
+	auth.c options.c sys-bsd.c sys-str.c sys-aix4.c ccp.c cbcp.c
+HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h cbc.h
 MANPAGES = pppd.8
 
 PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o \
-	auth.o options.o sys-aix4.o ccp.o
+	auth.o options.o sys-aix4.o ccp.o cbcp.o
 
 CC = xlc
 DEBUG_FLAGS = -DDEBUGALL
 # SECURE_FLAGS = -DREQ_SYSOPTIONS=1
 COMPILE_FLAGS = -DSTREAMS
 COPTS = -O
 LIBS= -bI:/lib/pse.exp
 LOCK_PREFIX=\"/var/locks/LCK..\"
 
 CFLAGS = -I.. $(COPTS) $(DEBUG_FLAGS) $(COMPILE_FLAGS) $(SECURE_FLAGS)
diff -r --unified=10 ppp-2.2a5.orig/pppd/Makefile.bsd ppp-2.2a5/pppd/Makefile.bsd
--- ppp-2.2a5.orig/pppd/Makefile.bsd	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/Makefile.bsd	Sat May 13 14:09:36 1995
@@ -1,18 +1,18 @@
 #	$Id: README.cbcp,v 1.1 1997/04/30 05:37:27 paulus Exp $
 
 BINDIR?= /usr/sbin
 CFLAGS+= -I.. -DHAVE_PATHS_H
 
 PROG=	pppd
 SRCS=	main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
-	auth.c options.c sys-bsd.c
+	auth.c options.c sys-bsd.c cbcp.c
 MAN8=	pppd.0
 # The next line is for NetBSD-current systems.
 MAN=	pppd.cat8
 BINMODE=4555
 BINOWN=	root
 
 LDADD=	-lcrypt -lutil
 DPADD=	${LIBCRYPT} ${LIBUTIL}
 
 .include <bsd.prog.mk>
diff -r --unified=10 ppp-2.2a5.orig/pppd/Makefile.linux ppp-2.2a5/pppd/Makefile.linux
--- ppp-2.2a5.orig/pppd/Makefile.linux	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/Makefile.linux	Sat May 13 13:46:36 1995
@@ -1,25 +1,25 @@
 #
 # pppd makefile for Linux
 # $Id: README.cbcp,v 1.1 1997/04/30 05:37:27 paulus Exp $
 #
 
 BINDIR = /usr/etc
 MANDIR = /usr/man
 
 PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
-	auth.c options.c sys-linux.c
-HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h
+	auth.c options.c sys-linux.c cbcp.c
+HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h cbcp.h
 MANPAGES = pppd.8
 
 PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \
-	auth.o options.o sys-linux.o
+	auth.o options.o sys-linux.o cbcp.o
 
 all: pppd
 
 #
 # include dependancies if present and backup if as a header file
 ifeq (.depend,$(wildcard .depend))
 include .depend
 HEADERS := $(HEADERS) .depend
 endif
 
diff -r --unified=10 ppp-2.2a5.orig/pppd/Makefile.osf ppp-2.2a5/pppd/Makefile.osf
--- ppp-2.2a5.orig/pppd/Makefile.osf	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/Makefile.osf	Sat May 13 14:09:54 1995
@@ -1,26 +1,26 @@
 #
 # pppd makefile for OSF/1 on DEC Alpha
 # $Id: README.cbcp,v 1.1 1997/04/30 05:37:27 paulus Exp $
 #
 
 BINDIR = /usr/local/etc
 MANDIR = /usr/local/man
 
 PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
 	auth.c options.c sys-bsd.c sys-str.c sys-ultrix.c sys-linux.c \
-	sys-osf.c
-HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h
+	sys-osf.c cbcp.c
+HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h cbcp.h
 MANPAGES = pppd.8
 
 PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \
-	auth.o options.o sys-osf.o
+	auth.o options.o sys-osf.o cbcp.o
 
 CC = cc
 DEBUG_FLAGS = -DDEBUGALL
 COMPILE_FLAGS = -DSTREAMS -DGIDSET_TYPE=int
 COPTS = -O2
 LIBS = 
 
 CFLAGS = -I.. $(COPTS) $(COMPILE_FLAGS)
 
 SOURCE= RELNOTES Makefile \
diff -r --unified=10 ppp-2.2a5.orig/pppd/Makefile.sol2 ppp-2.2a5/pppd/Makefile.sol2
--- ppp-2.2a5.orig/pppd/Makefile.sol2	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/Makefile.sol2	Sat May 13 14:10:09 1995
@@ -6,21 +6,21 @@
 BINDIR = /usr/local/etc
 MANDIR = /usr/local/man
 
 CC = gcc
 COPTS = -g -O2
 CFLAGS = $(COPTS) -I..
 
 INSTALL = /usr/sbin/install
 
 OBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \
-	auth.o options.o sys-sol2.o
+	auth.o options.o sys-sol2.o cbcp.o
 
 pppd:	$(OBJS)
 	$(CC) -o pppd $(OBJS) -lnsl
 
 install:
 	$(INSTALL) -f $(BINDIR) -m 4755 -u root pppd
 	$(INSTALL) -f $(MANDIR)/man8 pppd.8
 
 clean:
 	rm -f $(OBJS) pppd *~ core
diff -r --unified=10 ppp-2.2a5.orig/pppd/Makefile.sun ppp-2.2a5/pppd/Makefile.sun
--- ppp-2.2a5.orig/pppd/Makefile.sun	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/Makefile.sun	Sat May 13 14:10:27 1995
@@ -2,26 +2,26 @@
 # pppd makefile for Suns
 # $Id: README.cbcp,v 1.1 1997/04/30 05:37:27 paulus Exp $
 #
 
 BINDIR = /usr/local/etc
 MANDIR = /usr/local/man
 
 INSTALL= install -o root -g daemon
 
 PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
-	auth.c options.c sys-bsd.c sys-str.c sys-ultrix.c sys-linux.c
-HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h
+	auth.c options.c sys-bsd.c sys-str.c sys-ultrix.c sys-linux.c cbcp.c
+HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h cbcp.h
 MANPAGES = pppd.8
 
 PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \
-	auth.o options.o sys-str.o
+	auth.o options.o sys-str.o cbcp.o
 
 # CC = gcc
 DEBUG_FLAGS =
 COMPILE_FLAGS =
 COPTS = -O
 LIBS = -lkvm
 
 CFLAGS = -I.. $(COPTS) $(DEBUG_FLAGS) $(COMPILE_FLAGS)
 
 SOURCE= RELNOTES Makefile \
diff -r --unified=10 ppp-2.2a5.orig/pppd/Makefile.ultrix ppp-2.2a5/pppd/Makefile.ultrix
--- ppp-2.2a5.orig/pppd/Makefile.ultrix	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/Makefile.ultrix	Sat May 13 14:10:44 1995
@@ -1,25 +1,25 @@
 #
 # pppd makefile for Ultrix
 # $Id: README.cbcp,v 1.1 1997/04/30 05:37:27 paulus Exp $
 #
 
 BINDIR = /usr/local/etc
 MANDIR = /usr/local/man
 
 PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
-	auth.c options.c sys-bsd.c sys-str.c sys-ultrix.c sys-linux.c
-HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h
+	auth.c options.c sys-bsd.c sys-str.c sys-ultrix.c sys-linux.c cbcp.c
+HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h cbcp.h
 MANPAGES = pppd.8
 
 PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \
-	auth.o options.o sys-ultrix.o
+	auth.o options.o sys-ultrix.o cbcp.o
 
 # CC = gcc
 DEBUG_FLAGS =
 COMPILE_FLAGS = -DNO_DRAND48 -DGIDSET_TYPE=int
 COPTS = -O
 LIBS =
 
 CFLAGS = -I.. $(COPTS) $(DEBUG_FLAGS) $(COMPILE_FLAGS)
 
 SOURCE= RELNOTES Makefile \
diff -r --unified=10 ppp-2.2a5.orig/pppd/auth.c ppp-2.2a5/pppd/auth.c
--- ppp-2.2a5.orig/pppd/auth.c	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/auth.c	Sat May 13 13:46:36 1995
@@ -55,20 +55,21 @@
 #ifndef PW_PPP
 #define PW_PPP PW_LOGIN
 #endif
 #endif
 
 #include "pppd.h"
 #include "fsm.h"
 #include "lcp.h"
 #include "upap.h"
 #include "chap.h"
+#include "cbcp.h"
 #include "ipcp.h"
 #include "ccp.h"
 #include "pathnames.h"
 
 #ifdef sparc
 #include <alloca.h>
 #endif /*sparc*/
 
 /* Used for storing a sequence of words.  Usually malloced. */
 struct wordlist {
@@ -93,20 +94,21 @@
 /* Bits in auth_pending[] */
 #define UPAP_WITHPEER	1
 #define UPAP_PEER	2
 #define CHAP_WITHPEER	4
 #define CHAP_PEER	8
 
 /* Prototypes */
 void check_access __P((FILE *, char *));
 
 static void network_phase __P((int));
+static void callback_phase __P((int));
 static int  login __P((char *, char *, char **, int *));
 static void logout __P((void));
 static int  null_login __P((int));
 static int  get_upap_passwd __P((void));
 static int  have_upap_secret __P((void));
 static int  have_chap_secret __P((char *, char *));
 static int  scan_authfile __P((FILE *, char *, char *, char *,
 				  struct wordlist **, char *));
 static void free_wordlist __P((struct wordlist *));
 
@@ -140,20 +142,21 @@
 
 /*
  * LCP has gone down; it will either die or try to re-establish.
  */
 void
 link_down(unit)
     int unit;
 {
     ipcp_close(0);
     ccp_close(0);
+    cbcp_close(0);
     phase = PHASE_TERMINATE;
 }
 
 /*
  * The link is established.
  * Proceed to the Dead, Authenticate or Network phase as appropriate.
  */
 void
 link_established(unit)
     int unit;
@@ -189,36 +192,53 @@
     if (ho->neg_chap) {
 	ChapAuthWithPeer(unit, our_name, ho->chap_mdtype);
 	auth |= CHAP_WITHPEER;
     } else if (ho->neg_upap) {
 	upap_authwithpeer(unit, user, passwd);
 	auth |= UPAP_WITHPEER;
     }
     auth_pending[unit] = auth;
 
     if (!auth)
-	network_phase(unit);
+	callback_phase(unit);
 }
 
 /*
  * Proceed to the network phase.
  */
 static void
 network_phase(unit)
     int unit;
 {
     phase = PHASE_NETWORK;
     ipcp_open(unit);
     ccp_open(unit);
 }
 
 /*
+ * Proceed to the callback phase which may be empty.
+ */
+static void
+callback_phase(unit)
+     int unit;
+{
+    lcp_options *wo = &lcp_wantoptions[unit];
+
+    if (!wo->neg_cbcp)
+        network_phase(unit);
+    else {
+        phase = PHASE_CALLBACK;
+        cbcp_open(unit);
+    }
+}
+
+/*
  * The peer has failed to authenticate himself using `protocol'.
  */
 void
 auth_peer_fail(unit, protocol)
     int unit, protocol;
 {
     /*
      * Authentication failure: take the link down
      */
     lcp_close(unit);
@@ -242,27 +262,24 @@
 	bit = UPAP_PEER;
 	break;
     default:
 	syslog(LOG_WARNING, "auth_peer_success: unknown protocol %x",
 	       protocol);
 	return;
     }
 
     /*
      * If there is no more authentication still to be done,
-     * proceed to the network phase.
+     * go to the next phase.
      */
-    if ((auth_pending[unit] &= ~bit) == 0) {
-	phase = PHASE_NETWORK;
-	ipcp_open(unit);
-	ccp_open(unit);
-    }
+    if ((auth_pending[unit] &= ~bit) == 0)
+	callback_phase(unit);
 }
 
 /*
  * We have failed to authenticate ourselves to the peer using `protocol'.
  */
 void
 auth_withpeer_fail(unit, protocol)
     int unit, protocol;
 {
     /*
@@ -291,22 +308,23 @@
     default:
 	syslog(LOG_WARNING, "auth_peer_success: unknown protocol %x",
 	       protocol);
 	bit = 0;
     }
 
     /*
      * If there is no more authentication still being done,
      * proceed to the network phase.
      */
+
     if ((auth_pending[unit] &= ~bit) == 0)
-	network_phase(unit);
+	callback_phase(unit);
 }
 
 
 /*
  * check_auth_options - called to check authentication options.
  */
 void
 check_auth_options()
 {
     lcp_options *wo = &lcp_wantoptions[0];
@@ -335,21 +353,20 @@
     if (ao->neg_chap && !have_chap_secret(our_name, remote_name))
 	ao->neg_chap = 0;
     if (wo->neg_chap && !have_chap_secret(remote_name, our_name))
 	wo->neg_chap = 0;
 
     if (auth_required && !wo->neg_chap && !wo->neg_upap) {
 	fprintf(stderr, "\
 pppd: peer authentication required but no authentication files accessible\n");
 	exit(1);
     }
-
 }
 
 
 /*
  * check_passwd - Check the user name and passwd against the PAP secrets
  * file.  If requested, also check against the system password database,
  * and login the user if OK.
  *
  * returns:
  *	UPAP_AUTHNAK: Authentication failed.
diff -r --unified=10 ppp-2.2a5.orig/pppd/cbcp.c ppp-2.2a5/pppd/cbcp.c
--- ppp-2.2a5.orig/pppd/cbcp.c	Sat May 13 14:08:45 1995
+++ ppp-2.2a5/pppd/cbcp.c	Sat May 13 14:15:12 1995
@@ -0,0 +1,370 @@
+/*
+ * cbcp - Call Back Configuration Protocol.
+ *
+ * Copyright (c) 1995 Pedro Roque Marques
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by Pedro Roque Marques.  The name of the author may not be used to
+ * endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef lint
+static char rcsid[] = "$Id: README.cbcp,v 1.1 1997/04/30 05:37:27 paulus Exp $";
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <syslog.h>
+
+#include "pppd.h"
+#include "cbcp.h"
+#include "fsm.h"
+#include "lcp.h"
+#include "ipcp.h"
+
+cbcp_state cbcp[NUM_PPP];	
+
+/* internal prototypes */
+
+void cbcp_recvreq(cbcp_state *us, char *pckt, int len);
+void cbcp_resp(cbcp_state *us);
+void cbcp_up(cbcp_state *us);
+void cbcp_recvack(cbcp_state *us, char *pckt, int len);
+void cbcp_send(cbcp_state *us, u_char code, u_char *buf, int len);
+
+/* init state */
+void cbcp_init(int iface)
+{
+    cbcp_state *us;
+
+    us = &cbcp[iface];
+    memset(us, 0, sizeof(cbcp_state));
+    us->us_unit = iface;
+    us->us_type |= (1 << CB_CONF_NO);
+}
+
+/* lower layer is up */
+void cbcp_lowerup(int iface)
+{
+    cbcp_state *us = &cbcp[iface];
+
+    syslog(LOG_DEBUG, "cbcp_lowerup");
+    syslog(LOG_DEBUG, "want: %d", us->us_type);
+
+    if (us->us_type == CB_CONF_USER)
+        syslog(LOG_DEBUG, "phone no: %s", us->us_number);
+}
+
+void cbcp_open(int unit)
+{
+    syslog(LOG_DEBUG, "cbcp_open");
+}
+
+void cbcp_close(int unit)
+{
+}
+
+/* process an incomming packet */
+void cbcp_input(int unit, u_char *inpacket, int pktlen)
+{
+    u_char *inp;
+    u_char code, id;
+    u_short len;
+
+    cbcp_state *us = &cbcp[unit];
+
+    inp = inpacket;
+
+    if (pktlen < CBCP_MINLEN) {
+        syslog(LOG_ERR, "CBCP packet is too small");
+	return;
+    }
+
+    GETCHAR(code, inp);
+    GETCHAR(id, inp);
+    GETSHORT(len, inp);
+
+#if 0
+    if (len > pktlen) {
+        syslog(LOG_ERR, "CBCP packet: invalid length");
+        return;
+    }
+#endif
+
+    len -= CBCP_MINLEN;
+ 
+    switch(code) {
+    case CBCP_REQ:
+        us->us_id = id;
+	cbcp_recvreq(us, inp, len);
+	break;
+
+    case CBCP_RESP:
+	syslog(LOG_DEBUG, "CBCP_RESP received");
+	break;
+
+    case CBCP_ACK:
+	if (id != us->us_id)
+	    syslog(LOG_DEBUG, "id doesn't match: expected %d recv %d",
+		   us->us_id, id);
+
+	cbcp_recvack(us, inp, len);
+	break;
+
+    default:
+	break;
+    }
+}
+
+/* protocol was rejected by foe */
+void cbcp_protrej(int iface)
+{
+}
+
+char *cbcp_codenames[] = {"Request", "Response", "Ack"};
+
+char *cbcp_optionnames[] = {  "NoCallback",
+			      "UserDefined",
+			      "AdminDefined",
+			      "List"};
+/* pretty print a packet */
+int cbcp_printpkt(u_char *p, int plen,
+		   void (*printer) __P((void *, char *, ...)),
+		   void *arg)
+{
+    int code, opt, id, len, olen, delay;
+    u_char *pstart, *optend;
+    u_short cishort;
+    u_long cilong;
+
+    if (plen < HEADERLEN)
+	return 0;
+    pstart = p;
+    GETCHAR(code, p);
+    GETCHAR(id, p);
+    GETSHORT(len, p);
+    if (len < HEADERLEN || len > plen)
+	return 0;
+
+    if (code >= 1 && code <= sizeof(cbcp_codenames) / sizeof(char *))
+	printer(arg, " %s", cbcp_codenames[code-1]);
+    else
+	printer(arg, " code=0x%x", code); 
+
+    printer(arg, " id=0x%x", id);
+    len -= HEADERLEN;
+
+    switch (code) {
+    case CBCP_REQ:
+    case CBCP_RESP:
+    case CBCP_ACK:
+        while(len >= 2) {
+	    GETCHAR(opt, p);
+	    GETCHAR(olen, p);
+
+	    if (olen < 2 || olen > len) {
+	        break;
+	    }
+
+	    printer(arg, " <");
+	    len -= olen;
+
+	    if (opt >= 1 && opt <= sizeof(cbcp_optionnames) / sizeof(char *))
+	    	printer(arg, " %s", cbcp_optionnames[opt-1]);
+	    else
+	        printer(arg, " option=0x%x", opt); 
+
+	    if (olen > 2) {
+	        GETCHAR(delay, p);
+		printer(arg, " delay = %d", delay);
+	    }
+
+	    if (olen > 3) {
+	        int addrt;
+		char str[256];
+
+		GETCHAR(addrt, p);
+		memcpy(str, p, olen - 4);
+		str[olen - 4] = 0;
+		printer(arg, " number = %s", str);
+	    }
+	    printer(arg, ">");
+	break;
+	}
+
+      default:
+	break;
+    }
+
+    for (; len > 0; --len) {
+	GETCHAR(code, p);
+	printer(arg, " %.2x", code);
+    }
+
+    return p - pstart;
+}
+
+/* received CBCP request */
+
+void cbcp_recvreq(cbcp_state *us, char *pckt, int pcktlen)
+{
+    u_char type, opt_len, delay, addr_type;
+    char address[256];
+    int len = pcktlen;
+
+    address[0] = 0;
+
+    while (len) {
+        syslog(LOG_DEBUG, "length: %d", len);
+
+	GETCHAR(type, pckt);
+	GETCHAR(opt_len, pckt);
+
+	if (opt_len > 2)
+	    GETCHAR(delay, pckt);
+
+	us->us_allowed |= (1 << type);
+
+	switch(type) {
+	case CB_CONF_NO:
+	    syslog(LOG_DEBUG, "no callback allowed");
+	    break;
+
+      case CB_CONF_USER:
+	    syslog(LOG_DEBUG, "user callback allowed");
+	    if (opt_len > 4) {
+	        GETCHAR(addr_type, pckt);
+		memcpy(address, pckt, opt_len - 4);
+		address[opt_len - 4] = 0;
+		if (address[0])
+		    syslog(LOG_DEBUG, "address: %s", address);
+	    }
+	break;
+
+      case CB_CONF_ADMIN:
+	    syslog(LOG_DEBUG, "user admin defined allowed");
+	    break;
+
+      case CB_CONF_LIST:
+	    break;
+	}
+	len -= opt_len;
+    }
+
+  cbcp_resp(us);
+}
+
+void cbcp_resp(cbcp_state *us)
+{
+    u_char cb_type;
+    u_char buf[256];
+    u_char *bufp = buf;
+    int len = 0;
+
+    cb_type = us->us_allowed & us->us_type;
+    syslog(LOG_DEBUG, "cbcp_resp cb_type=%d", cb_type);
+
+#if 0
+    if (!cb_type)
+        lcp_down(us->us_unit);
+#endif
+
+    if (cb_type & ( 1 << CB_CONF_USER ) ) {
+	syslog(LOG_DEBUG, "cbcp_resp CONF_USER");
+	PUTCHAR(CB_CONF_USER, bufp);
+	len = 3 + 1 + strlen(us->us_number) + 1;
+	PUTCHAR(len , bufp);
+	PUTCHAR(5, bufp); /* delay */
+	PUTCHAR(1, bufp);
+	BCOPY(us->us_number, bufp, strlen(us->us_number) + 1);
+	cbcp_send(us, CBCP_RESP, buf, len);
+	return;
+    }
+
+    if (cb_type & ( 1 << CB_CONF_ADMIN ) ) {
+        PUTCHAR(CB_CONF_ADMIN, bufp);
+	len = 3;
+	PUTCHAR(len , bufp);
+	PUTCHAR(0, bufp);
+	cbcp_send(us, CBCP_RESP, buf, len);
+	return;
+    }
+
+    if (cb_type & ( 1 << CB_CONF_NO ) ) {
+        syslog(LOG_DEBUG, "cbcp_resp CONF_NO");
+	PUTCHAR(CB_CONF_NO, bufp);
+	len = 3;
+	PUTCHAR(len , bufp);
+	PUTCHAR(0, bufp);
+	cbcp_send(us, CBCP_RESP, buf, len);
+	ipcp_open(us->us_unit);
+	return;
+    }
+}
+
+void cbcp_send(cbcp_state *us, u_char code, u_char *buf, int len)
+{
+    u_char *outp;
+    int outlen;
+
+    outp = outpacket_buf;
+
+    outlen = 4 + len;
+    
+    MAKEHEADER(outp, PPP_CBCP);
+
+    PUTCHAR(code, outp);
+    PUTCHAR(us->us_id, outp);
+    PUTSHORT(outlen, outp);
+    
+    if (len)
+        BCOPY(buf, outp, len);
+
+    output(us->us_unit, outpacket_buf, outlen + PPP_HDRLEN);
+}
+
+void cbcp_recvack(cbcp_state *us, char *pckt, int len)
+{
+    u_char type, delay, addr_type;
+    int opt_len;
+    char address[256];
+
+    if (len) {
+        GETCHAR(type, pckt);
+	GETCHAR(opt_len, pckt);
+     
+	if (opt_len > 2)
+	    GETCHAR(delay, pckt);
+
+	if (opt_len > 4) {
+	    GETCHAR(addr_type, pckt);
+	    memcpy(address, pckt, opt_len - 4);
+	    address[opt_len - 4] = 0;
+	    if (address[0])
+	        syslog(LOG_DEBUG, "peer will call: %s", address);
+	}
+    }
+
+    cbcp_up(us);
+}
+
+extern int persist;
+
+/* ok peer will do callback */
+void cbcp_up(cbcp_state *us)
+{
+    persist = 0;
+    lcp_close(0);
+}
diff -r --unified=10 ppp-2.2a5.orig/pppd/cbcp.h ppp-2.2a5/pppd/cbcp.h
--- ppp-2.2a5.orig/pppd/cbcp.h	Sat May 13 14:08:40 1995
+++ ppp-2.2a5/pppd/cbcp.h	Sat May 13 13:56:20 1995
@@ -0,0 +1,33 @@
+#ifndef CBCP_H
+#define CBCP_H
+
+typedef struct cbcp_state {
+    int    us_unit;	/* Interface unit number */
+    u_char us_id;		/* Current id */
+    u_char us_allowed;
+    int    us_type;
+    char   *us_number;    /* Telefone Number */
+} cbcp_state;
+
+void cbcp_init      __P((int));
+void cbcp_open      __P((int));
+void cbcp_lowerup   __P((int));
+void cbcp_input     __P((int, u_char *, int));
+void cbcp_protrej   __P((int));
+int  cbcp_printpkt  __P((u_char *, int,
+			    void (*) __P((void *, char *, ...)),
+			    void *));
+
+extern cbcp_state cbcp[];
+
+#define CBCP_MINLEN 4
+
+#define CBCP_REQ    1
+#define CBCP_RESP   2
+#define CBCP_ACK    3
+
+#define CB_CONF_NO     1
+#define CB_CONF_USER   2
+#define CB_CONF_ADMIN  3
+#define CB_CONF_LIST   4
+#endif
diff -r --unified=10 ppp-2.2a5.orig/pppd/lcp.c ppp-2.2a5/pppd/lcp.c
--- ppp-2.2a5.orig/pppd/lcp.c	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/lcp.c	Sat May 13 13:46:36 1995
@@ -112,24 +112,26 @@
     lcp_extcode,		/* Called to handle LCP-specific codes */
     "LCP"			/* String name of protocol */
 };
 
 int lcp_warnloops = DEFWARNLOOPS; /* Warn about a loopback this often */
 
 /*
  * Length of each type of configuration option (in octets)
  */
 #define CILEN_VOID	2
+#define CILEN_CHAR      3
 #define CILEN_SHORT	4	/* CILEN_VOID + sizeof(short) */
 #define CILEN_CHAP	5	/* CILEN_VOID + sizeof(short) + 1 */
 #define CILEN_LONG	6	/* CILEN_VOID + sizeof(long) */
 #define CILEN_LQR	8	/* CILEN_VOID + sizeof(short) + sizeof(long) */
+#define CILEN_CBCP      3
 
 #define CODENAME(x)	((x) == CONFACK ? "ACK" : \
 			 (x) == CONFNAK ? "NAK" : "REJ")
 
 
 /*
  * lcp_init - Initialize LCP.
  */
 void
 lcp_init(unit)
@@ -153,32 +155,34 @@
     wo->mru = DEFMRU;
     wo->neg_asyncmap = 0;
     wo->asyncmap = 0;
     wo->neg_chap = 0;			/* Set to 1 on server */
     wo->neg_upap = 0;			/* Set to 1 on server */
     wo->chap_mdtype = CHAP_DIGEST_MD5;
     wo->neg_magicnumber = 1;
     wo->neg_pcompression = 1;
     wo->neg_accompression = 1;
     wo->neg_lqr = 0;			/* no LQR implementation yet */
+    wo->neg_cbcp = 0;
 
     ao->neg_mru = 1;
     ao->mru = MAXMRU;
     ao->neg_asyncmap = 1;
     ao->asyncmap = 0;
     ao->neg_chap = 1;
     ao->chap_mdtype = CHAP_DIGEST_MD5;
     ao->neg_upap = 1;
     ao->neg_magicnumber = 1;
     ao->neg_pcompression = 1;
     ao->neg_accompression = 1;
     ao->neg_lqr = 0;			/* no LQR implementation yet */
+    ao->neg_cbcp = 1;
 
     memset(xmit_accm[unit], 0, sizeof(xmit_accm[0]));
     xmit_accm[unit][3] = 0x60000000;
 }
 
 
 /*
  * lcp_open - LCP is allowed to come up.
  */
 void
@@ -478,29 +482,31 @@
 lcp_cilen(f)
     fsm *f;
 {
     lcp_options *go = &lcp_gotoptions[f->unit];
 
 #define LENCIVOID(neg)	(neg ? CILEN_VOID : 0)
 #define LENCICHAP(neg)	(neg ? CILEN_CHAP : 0)
 #define LENCISHORT(neg)	(neg ? CILEN_SHORT : 0)
 #define LENCILONG(neg)	(neg ? CILEN_LONG : 0)
 #define LENCILQR(neg)	(neg ? CILEN_LQR: 0)
+#define LENCICBCP(neg)	(neg ? CILEN_CBCP: 0)
     /*
      * NB: we only ask for one of CHAP and UPAP, even if we will
      * accept either.
      */
     return (LENCISHORT(go->neg_mru) +
 	    LENCILONG(go->neg_asyncmap) +
 	    LENCICHAP(go->neg_chap) +
 	    LENCISHORT(!go->neg_chap && go->neg_upap) +
 	    LENCILQR(go->neg_lqr) +
+	    LENCICBCP(go->neg_cbcp) +
 	    LENCILONG(go->neg_magicnumber) +
 	    LENCIVOID(go->neg_pcompression) +
 	    LENCIVOID(go->neg_accompression));
 }
 
 
 /*
  * lcp_addci - Add our desired CIs to a packet.
  */
 static void
@@ -537,25 +543,33 @@
 	PUTLONG(val, ucp); \
     }
 #define ADDCILQR(opt, neg, val) \
     if (neg) { \
 	PUTCHAR(opt, ucp); \
 	PUTCHAR(CILEN_LQR, ucp); \
 	PUTSHORT(PPP_LQR, ucp); \
 	PUTLONG(val, ucp); \
     }
 
+#define ADDCICHAR(opt, neg, val) \
+    if (neg) { \
+	PUTCHAR(opt, ucp); \
+	PUTCHAR(CILEN_CHAR, ucp); \
+	PUTCHAR(val, ucp); \
+    }
+
     ADDCISHORT(CI_MRU, go->neg_mru, go->mru);
     ADDCILONG(CI_ASYNCMAP, go->neg_asyncmap, go->asyncmap);
     ADDCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype);
     ADDCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP);
     ADDCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
+    ADDCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
     ADDCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
     ADDCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
     ADDCIVOID(CI_ACCOMPRESSION, go->neg_accompression);
 
     if (ucp - start_ucp != *lenp) {
 	/* this should never happen, because peer_mtu should be 1500 */
 	syslog(LOG_ERR, "Bug in lcp_addci: wrong length");
     }
 }
 
@@ -600,20 +614,33 @@
 	    goto bad; \
 	GETCHAR(citype, p); \
 	GETCHAR(cilen, p); \
 	if (cilen != CILEN_SHORT || \
 	    citype != opt) \
 	    goto bad; \
 	GETSHORT(cishort, p); \
 	if (cishort != val) \
 	    goto bad; \
     }
+#define ACKCICHAR(opt, neg, val) \
+    if (neg) { \
+	if ((len -= CILEN_CHAR) < 0) \
+	    goto bad; \
+	GETCHAR(citype, p); \
+	GETCHAR(cilen, p); \
+	if (cilen != CILEN_CHAR || \
+	    citype != opt) \
+	    goto bad; \
+	GETCHAR(cichar, p); \
+	if (cichar != val) \
+	    goto bad; \
+    }
 #define ACKCICHAP(opt, neg, val, digest) \
     if (neg) { \
 	if ((len -= CILEN_CHAP) < 0) \
 	    goto bad; \
 	GETCHAR(citype, p); \
 	GETCHAR(cilen, p); \
 	if (cilen != CILEN_CHAP || \
 	    citype != opt) \
 	    goto bad; \
 	GETSHORT(cishort, p); \
@@ -651,20 +678,21 @@
 	GETLONG(cilong, p); \
 	if (cilong != val) \
 	  goto bad; \
     }
 
     ACKCISHORT(CI_MRU, go->neg_mru, go->mru);
     ACKCILONG(CI_ASYNCMAP, go->neg_asyncmap, go->asyncmap);
     ACKCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype);
     ACKCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP);
     ACKCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
+    ACKCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
     ACKCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
     ACKCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
     ACKCIVOID(CI_ACCOMPRESSION, go->neg_accompression);
 
     /*
      * If there are any remaining CIs, then this packet is bad.
      */
     if (len != 0)
 	goto bad;
     return (1);
@@ -722,20 +750,31 @@
 	len >= CILEN_CHAP && \
 	p[1] == CILEN_CHAP && \
 	p[0] == opt) { \
 	len -= CILEN_CHAP; \
 	INCPTR(2, p); \
 	GETSHORT(cishort, p); \
 	GETCHAR(cichar, p); \
 	no.neg = 1; \
 	code \
     }
+#define NAKCICHAR(opt, neg, code) \
+    if (go->neg && \
+	len >= CILEN_CHAR && \
+	p[1] == CILEN_CHAR && \
+	p[0] == opt) { \
+	len -= CILEN_CHAR; \
+	INCPTR(2, p); \
+	GETCHAR(cichar, p); \
+	no.neg = 1; \
+	code \
+    }
 #define NAKCISHORT(opt, neg, code) \
     if (go->neg && \
 	len >= CILEN_SHORT && \
 	p[1] == CILEN_SHORT && \
 	p[0] == opt) { \
 	len -= CILEN_SHORT; \
 	INCPTR(2, p); \
 	GETSHORT(cishort, p); \
 	no.neg = 1; \
 	code \
@@ -851,20 +890,27 @@
      * If they Nak the reporting period, take their value XXX ?
      */
     NAKCILQR(CI_QUALITY, neg_lqr,
 	     if (cishort != PPP_LQR)
 		 try.neg_lqr = 0;
 	     else
 		 try.lqr_period = cilong;
 	     );
 
     /*
+     * Only implementing CBCP... not the rest of the callback options
+     */
+    NAKCICHAR(CI_CALLBACK, neg_cbcp,
+	      try.neg_cbcp = 0;
+	      );
+
+    /*
      * Check for a looped-back line.
      */
     NAKCILONG(CI_MAGICNUMBER, neg_magicnumber,
 	      try.magicnumber = magic();
 	      ++try.numloops;
 	      looped_back = 1;
 	      );
 
     NAKCIVOID(CI_PCOMPRESSION, neg_pcompression,
 	      try.neg_pcompression = 0;
@@ -1045,28 +1091,43 @@
 	len -= CILEN_LQR; \
 	INCPTR(2, p); \
 	GETSHORT(cishort, p); \
 	GETLONG(cilong, p); \
 	/* Check rejected value. */ \
 	if (cishort != PPP_LQR || cilong != val) \
 	    goto bad; \
 	try.neg = 0; \
 	LCPDEBUG((LOG_INFO,"lcp_rejci rejected LQR opt %d", opt)); \
     }
+#define REJCICBCP(opt, neg, val) \
+    if (go->neg && \
+	len >= CILEN_CBCP && \
+	p[1] == CILEN_CBCP && \
+	p[0] == opt) { \
+	len -= CILEN_CBCP; \
+	INCPTR(2, p); \
+	GETCHAR(cichar, p); \
+	/* Check rejected value. */ \
+	if (cichar != val) \
+	    goto bad; \
+	try.neg = 0; \
+	LCPDEBUG((LOG_INFO,"lcp_rejci rejected Callback opt %d", opt)); \
+    }
 
     REJCISHORT(CI_MRU, neg_mru, go->mru);
     REJCILONG(CI_ASYNCMAP, neg_asyncmap, go->asyncmap);
     REJCICHAP(CI_AUTHTYPE, neg_chap, PPP_CHAP, go->chap_mdtype);
     if (!go->neg_chap) {
 	REJCISHORT(CI_AUTHTYPE, neg_upap, PPP_PAP);
     }
     REJCILQR(CI_QUALITY, neg_lqr, go->lqr_period);
+    REJCICBCP(CI_CALLBACK, neg_cbcp, CBCP_OPT);
     REJCILONG(CI_MAGICNUMBER, neg_magicnumber, go->magicnumber);
     REJCIVOID(CI_PCOMPRESSION, neg_pcompression);
     REJCIVOID(CI_ACCOMPRESSION, neg_accompression);
 
     /*
      * If there are any remaining CIs, then this packet is bad.
      */
     if (len != 0)
 	goto bad;
     /*
@@ -1447,20 +1508,21 @@
      */
     ppp_recv_config(f->unit, (go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU),
 		    (go->neg_asyncmap? go->asyncmap: 0x00000000),
 		    go->neg_pcompression, go->neg_accompression);
 
     if (ho->neg_mru)
 	peer_mru[f->unit] = ho->mru;
 
     ChapLowerUp(f->unit);	/* Enable CHAP */
     upap_lowerup(f->unit);	/* Enable UPAP */
+    cbcp_lowerup(f->unit);      /* Enable CBCP */
     ipcp_lowerup(f->unit);	/* Enable IPCP */
     ccp_lowerup(f->unit);	/* Enable CCP */
     lcp_echo_lowerup(f->unit);  /* Enable echo messages */
 
     link_established(f->unit);
 }
 
 
 /*
  * lcp_down - LCP has gone DOWN.
@@ -1593,20 +1655,34 @@
 		}
 		break;
 	    case CI_QUALITY:
 		if (olen >= CILEN_SHORT) {
 		    p += 2;
 		    printer(arg, "quality ");
 		    GETSHORT(cishort, p);
 		    switch (cishort) {
 		    case PPP_LQR:
 			printer(arg, "lqr");
+			break;
+		    default:
+			printer(arg, "0x%x", cishort);
+		    }
+		}
+		break;
+	    case CI_CALLBACK:
+		if (olen >= CILEN_CHAR) {
+		    p += 2;
+		    printer(arg, "callback ");
+		    GETSHORT(cishort, p);
+		    switch (cishort) {
+		    case CBCP_OPT:
+			printer(arg, "CBCP");
 			break;
 		    default:
 			printer(arg, "0x%x", cishort);
 		    }
 		}
 		break;
 	    case CI_MAGICNUMBER:
 		if (olen == CILEN_LONG) {
 		    p += 2;
 		    GETLONG(cilong, p);
diff -r --unified=10 ppp-2.2a5.orig/pppd/lcp.h ppp-2.2a5/pppd/lcp.h
--- ppp-2.2a5.orig/pppd/lcp.h	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/lcp.h	Sat May 13 13:46:36 1995
@@ -22,44 +22,47 @@
 /*
  * Options.
  */
 #define CI_MRU		1	/* Maximum Receive Unit */
 #define CI_ASYNCMAP	2	/* Async Control Character Map */
 #define CI_AUTHTYPE	3	/* Authentication Type */
 #define CI_QUALITY	4	/* Quality Protocol */
 #define CI_MAGICNUMBER	5	/* Magic Number */
 #define CI_PCOMPRESSION	7	/* Protocol Field Compression */
 #define CI_ACCOMPRESSION 8	/* Address/Control Field Compression */
+#define CI_CALLBACK      13     /* callback */
 
 /*
  * LCP-specific packet types.
  */
 #define PROTREJ		8	/* Protocol Reject */
 #define ECHOREQ		9	/* Echo Request */
 #define ECHOREP		10	/* Echo Reply */
 #define DISCREQ		11	/* Discard Request */
+#define CBCP_OPT        6       /* Use callback control protocol */
 
 /*
  * The state of options is described by an lcp_options structure.
  */
 typedef struct lcp_options {
     int passive : 1;		/* Don't die if we don't get a response */
     int silent : 1;		/* Wait for the other end to start first */
     int restart : 1;		/* Restart vs. exit after close */
     int neg_mru : 1;		/* Negotiate the MRU? */
     int neg_asyncmap : 1;	/* Negotiate the async map? */
     int neg_upap : 1;		/* Ask for UPAP authentication? */
     int neg_chap : 1;		/* Ask for CHAP authentication? */
     int neg_magicnumber : 1;	/* Ask for magic number? */
     int neg_pcompression : 1;	/* HDLC Protocol Field Compression? */
     int neg_accompression : 1;	/* HDLC Address/Control Field Compression? */
     int neg_lqr : 1;		/* Negotiate use of Link Quality Reports */
+    int neg_cbcp : 1;           /* Negotiate use of CBCP */
     u_short mru;		/* Value of MRU */
     u_char chap_mdtype;		/* which MD type (hashing algorithm) */
     u_int32_t asyncmap;		/* Value of async map */
     u_int32_t magicnumber;
     int numloops;		/* Number of loops during magic number neg. */
     u_int32_t lqr_period;	/* Reporting period for link quality */
 } lcp_options;
 
 extern fsm lcp_fsm[];
 extern lcp_options lcp_wantoptions[];
diff -r --unified=10 ppp-2.2a5.orig/pppd/main.c ppp-2.2a5/pppd/main.c
--- ppp-2.2a5.orig/pppd/main.c	Sat May 13 12:38:20 1995
+++ ppp-2.2a5/pppd/main.c	Sat May 13 13:46:36 1995
@@ -40,20 +40,21 @@
 #include <sys/socket.h>
 #include <net/if.h>
 
 #include "pppd.h"
 #include "magic.h"
 #include "fsm.h"
 #include "lcp.h"
 #include "ipcp.h"
 #include "upap.h"
 #include "chap.h"
+#include "cbcp.h"
 #include "ccp.h"
 #include "pathnames.h"
 #include "patchlevel.h"
 
 /*
  * If REQ_SYSOPTIONS is defined to 1, pppd will not run unless
  * /etc/ppp/options exists.
  */
 #ifndef	REQ_SYSOPTIONS
 #define REQ_SYSOPTIONS	1
@@ -129,20 +130,22 @@
     int  (*printpkt)();
     void (*datainput)();
     char *name;
 } prottbl[] = {
     { PPP_LCP, lcp_init, lcp_input, lcp_protrej,
 	  lcp_printpkt, NULL, "LCP" },
     { PPP_IPCP, ipcp_init, ipcp_input, ipcp_protrej,
 	  ipcp_printpkt, NULL, "IPCP" },
     { PPP_PAP, upap_init, upap_input, upap_protrej,
 	  upap_printpkt, NULL, "PAP" },
+    { PPP_CBCP, cbcp_init, cbcp_input, cbcp_protrej,
+	  cbcp_printpkt, NULL, "CBCP" },
     { PPP_CHAP, ChapInit, ChapInput, ChapProtocolReject,
 	  ChapPrintPkt, NULL, "CHAP" },
     { PPP_CCP, ccp_init, ccp_input, ccp_protrej,
 	  ccp_printpkt, ccp_datainput, "CCP" },
 };
 
 #define N_PROTO		(sizeof(prottbl) / sizeof(prottbl[0]))
 
 main(argc, argv)
     int argc;
diff -r --unified=10 ppp-2.2a5.orig/pppd/options.c ppp-2.2a5/pppd/options.c
--- ppp-2.2a5.orig/pppd/options.c	Sat May 13 12:38:21 1995
+++ ppp-2.2a5/pppd/options.c	Sat May 13 13:59:24 1995
@@ -36,20 +36,21 @@
 #include <netinet/in.h>
 
 #include "pppd.h"
 #include "pathnames.h"
 #include "patchlevel.h"
 #include "fsm.h"
 #include "lcp.h"
 #include "ipcp.h"
 #include "upap.h"
 #include "chap.h"
+#include "cbcp.h"
 #include "ccp.h"
 
 #include <net/ppp-comp.h>
 
 #define FALSE	0
 #define TRUE	1
 
 #if defined(ultrix) || defined(NeXT)
 char *strdup __P((char *));
 #endif
@@ -112,20 +113,21 @@
 static int reqchap __P((void));
 static int setspeed __P((char *));
 static int noaccomp __P((void));
 static int noasyncmap __P((void));
 static int noipaddr __P((void));
 static int nomagicnumber __P((void));
 static int setasyncmap __P((char **));
 static int setescape __P((char **));
 static int setmru __P((char **));
 static int setmtu __P((char **));
+static int setcbcp __P((char **));
 static int nomru __P((void));
 static int nopcomp __P((void));
 static int setconnector __P((char **));
 static int setdisconnector __P((char **));
 static int setdomain __P((char **));
 static int setnetmask __P((char **));
 static int setcrtscts __P((void));
 static int setnocrtscts __P((void));
 static int setxonxoff __P((void));
 static int setnodetach __P((void));
@@ -202,20 +204,21 @@
     {"connect", 1, setconnector}, /* A program to set up a connection */
     {"disconnect", 1, setdisconnector},	/* program to disconnect serial dev. */
     {"crtscts", 0, setcrtscts},	/* set h/w flow control */
     {"-crtscts", 0, setnocrtscts}, /* clear h/w flow control */
     {"xonxoff", 0, setxonxoff},	/* set s/w flow control */
     {"debug", 0, setdebug},	/* Increase debugging level */
     {"kdebug", 1, setkdebug},	/* Enable kernel-level debugging */
     {"domain", 1, setdomain},	/* Add given domain name to hostname*/
     {"mru", 1, setmru},		/* Set MRU value for negotiation */
     {"mtu", 1, setmtu},		/* Set our MTU */
+    {"cb", 1, setcbcp},		/* Set CBCP */
     {"netmask", 1, setnetmask},	/* set netmask */
     {"passive", 0, setpassive},	/* Set passive mode */
     {"silent", 0, setsilent},	/* Set silent mode */
     {"modem", 0, setmodem},	/* Use modem control lines */
     {"local", 0, setlocal},	/* Don't use modem control lines */
     {"lock", 0, setlock},	/* Lock serial device (with lock file) */
     {"name", 1, setname},	/* Set local name for authentication */
     {"user", 1, setuser},	/* Set username for PAP auth with peer */
     {"usehostname", 0, setusehostname},	/* Must use hostname for auth. */
     {"remotename", 1, setremote}, /* Set remote name for authentication */
@@ -775,20 +778,31 @@
 	return 0;
     if (mtu < MINMRU || mtu > MAXMRU) {
 	fprintf(stderr, "mtu option value of %ld is too %s\n", mtu,
 		(mtu < MINMRU? "small": "large"));
 	return 0;
     }
     lcp_allowoptions[0].mru = mtu;
     return (1);
 }
 
+static int
+setcbcp(argv)
+    char **argv;
+{
+    lcp_wantoptions[0].neg_cbcp = 1;
+   
+    cbcp[0].us_number = (char *) malloc(strlen(*argv) + 1);
+    strcpy(cbcp[0].us_number, *argv);
+    cbcp[0].us_type |= (1 << CB_CONF_USER);
+    return (1);
+}
 
 /*
  * nopcomp - Disable Protocol field compression negotiation.
  */
 static int
 nopcomp()
 {
     lcp_wantoptions[0].neg_pcompression = 0;
     lcp_allowoptions[0].neg_pcompression = 0;
     return (1);
diff -r --unified=10 ppp-2.2a5.orig/pppd/pppd.8 ppp-2.2a5/pppd/pppd.8
--- ppp-2.2a5.orig/pppd/pppd.8	Sat May 13 12:38:21 1995
+++ ppp-2.2a5/pppd/pppd.8	Sat May 13 13:52:26 1995
@@ -221,20 +221,31 @@
 .B -pap
 Don't agree to authenticate using PAP.
 .TP
 .B +chap
 Require the peer to authenticate itself using CHAP [Cryptographic
 Handshake Authentication Protocol] authentication.
 .TP
 .B -chap
 Don't agree to authenticate using CHAP.
 .TP
+.B cb \fItelephone_number
+Configure the current execution of pppd to negotiate the \fIclient\fR
+portion of '\fIC\fRall \fIB\fRack \fIC\fRonfiguration
+\fIP\fRrotocol'. The use of this protocol will permit the client to
+authenticate itself with the server and then supply a telephone number
+for the reverse connection. Once the telephone number is accepted, the
+connection will be terminated. You should then wait for the server to
+recall your location and re-authenticate yourself. This second step
+will require a second execution of \fIpppd\fR. This second execution should
+not include the \fIcb\fR option.
+.TP
 .B -vj
 Disable negotiation of Van Jacobson style IP header compression (use
 default, i.e. no compression).
 .TP
 .B bsdcomp \fInr,nt
 Request that the peer compress packets that it sends, using the
 BSD-Compress scheme, with a maximum code size of \fInr\fR bits, and
 agree to compress packets sent to the peer with a maximum code size of
 \fInt\fR bits.  If \fInt\fR is not specified, it defaults to the value
 given for \fInr\fR.  Values in the range 9 to 15 may be used for
diff -r --unified=10 ppp-2.2a5.orig/pppd/pppd.h ppp-2.2a5/pppd/pppd.h
--- ppp-2.2a5.orig/pppd/pppd.h	Sat May 13 12:38:21 1995
+++ ppp-2.2a5/pppd/pppd.h	Sat May 13 13:46:36 1995
@@ -85,22 +85,23 @@
 extern int	disable_defaultip; /* Don't use hostname for default IP adrs */
 extern char	*ipparam;	/* Extra parameter for ip up/down scripts */
 extern int	cryptpap;	/* Others' PAP passwords are encrypted */
 
 /*
  * Values for phase.
  */
 #define PHASE_DEAD		0
 #define PHASE_ESTABLISH		1
 #define PHASE_AUTHENTICATE	2
-#define PHASE_NETWORK		3
-#define PHASE_TERMINATE		4
+#define PHASE_CALLBACK          3
+#define PHASE_NETWORK		4
+#define PHASE_TERMINATE		5
 
 /*
  * Prototypes.
  */
 void quit __P((void));	/* Cleanup and exit */
 void timeout __P((void (*)(), caddr_t, int));
 				/* Look-alike of kernel's timeout() */
 void untimeout __P((void (*)(), caddr_t));
 				/* Look-alike of kernel's untimeout() */
 void output __P((int, u_char *, int));