←︎ unrealircd :: f8a6fed


1
commit f8a6fedfcf8615daf5ddc559cfe199a3e808f359
2
Author: acidvegas <acid.vegas@acid.vegas>
3
Date:   Sun Mar 29 05:16:53 2020 -0400
4
5
    Initial commit
6
---
7
 .gitignore                                         |    75 +
8
 Config                                             |   793 ++
9
 LICENSE                                            |   340 +
10
 Makefile.in                                        |   255 +
11
 Makefile.windows                                   |  1084 ++
12
 README.md                                          |    58 +
13
 autoconf/Makefile                                  |     3 +
14
 autoconf/config.guess                              |  1438 +++
15
 autoconf/config.sub                                |  1810 ++++
16
 autoconf/install-sh                                |     0
17
 autoconf/m4/ax_check_compile_flag.m4               |    72 +
18
 autoconf/m4/ax_check_link_flag.m4                  |    71 +
19
 autoconf/m4/ax_pthread.m4                          |   332 +
20
 autoconf/m4/unreal.m4                              |   254 +
21
 autogen.sh                                         |    11 +
22
 configure                                          |  9027 ++++++++++++++++
23
 configure.ac                                       |   721 ++
24
 doc/Authors                                        |   148 +
25
 doc/Config.header                                  |    32 +
26
 doc/Donation                                       |    14 +
27
 doc/RELEASE-NOTES.md                               |   563 +
28
 doc/coding-guidelines                              |   123 +
29
 doc/compiling_win32.txt                            |     2 +
30
 doc/conf/badwords.conf                             |    99 +
31
 doc/conf/except.conf                               |    35 +
32
 doc/conf/ircd.motd                                 |    47 +
33
 doc/conf/links.conf                                |    11 +
34
 doc/conf/modules.conf                              |   190 +
35
 doc/conf/modules.sources.list                      |     1 +
36
 doc/conf/opers.conf                                |   162 +
37
 doc/conf/remote.motd                               |     0
38
 doc/conf/spamfilter.conf                           |     7 +
39
 doc/conf/tls/curl-ca-bundle.crt                    |  3432 ++++++
40
 doc/conf/unrealircd.hub.conf                       |    55 +
41
 doc/conf/unrealircd.link.conf                      |     7 +
42
 doc/conf/unrealircd.remote.conf                    |   185 +
43
 doc/tao.of.irc                                     |   271 +
44
 doc/technical/005.txt                              |   180 +
45
 doc/technical/base64.txt                           |    11 +
46
 doc/technical/serverprotocol.txt                   |     2 +
47
 doc/translations.txt                               |    26 +
48
 extras/.indent.pro                                 |    52 +
49
 extras/VStudioAnalyze.ruleset                      |   155 +
50
 extras/argon2-20181209.tar.gz                      |   Bin 0 -> 55140 bytes
51
 extras/build-tests/nix/build                       |    74 +
52
 extras/build-tests/nix/configs/default             |    24 +
53
 extras/build-tests/nix/run-tests                   |    44 +
54
 extras/build-tests/nix/run-tests.bbwrapper         |    14 +
55
 extras/build-tests/nix/select-config               |   114 +
56
 extras/build-tests/windows/build.bat               |    86 +
57
 extras/build-tests/windows/compilecmd/vs2019.bat   |    18 +
58
 extras/c-ares.tar.gz                               |   Bin 0 -> 1347687 bytes
59
 extras/curlinstall                                 |    98 +
60
 extras/doxygen/Developers.md                       |    17 +
61
 extras/doxygen/Doxyfile                            |  2494 +++++
62
 extras/doxygen/doxygen_custom.css                  |     4 +
63
 extras/doxygen/header.html                         |    56 +
64
 extras/patches/patch_spamfilter_conf               |    40 +
65
 extras/patches/spamfilter.conf.patch               |   328 +
66
 extras/pcre2.tar.gz                                |   Bin 0 -> 2234905 bytes
67
 extras/security/apparmor/unrealircd                |    27 +
68
 extras/tests/tls/cipherscan_profiles/baseline.txt  |    27 +
69
 .../tests/tls/cipherscan_profiles/openssl-101.txt  |    27 +
70
 extras/tests/tls/tls-tests                         |    90 +
71
 extras/tls.cnf                                     |    31 +
72
 extras/unreal.supp                                 |    10 +
73
 extras/wrap-compiler-for-flag-check                |    22 +
74
 include/channel.h                                  |    40 +
75
 include/common.h                                   |   240 +
76
 include/config.h                                   |   327 +
77
 include/crypt_blowfish.h                           |    27 +
78
 include/dbuf.h                                     |   101 +
79
 include/dns.h                                      |    72 +
80
 include/dynconf.h                                  |   375 +
81
 include/fdlist.h                                   |    52 +
82
 include/h.h                                        |   967 ++
83
 include/ircsprintf.h                               |    23 +
84
 include/license.h                                  |    48 +
85
 include/list.h                                     |   592 ++
86
 include/mempool.h                                  |   105 +
87
 include/modules.h                                  |  1379 +++
88
 include/modversion.h                               |    68 +
89
 include/msg.h                                      |   173 +
90
 include/numeric.h                                  |   396 +
91
 include/openssl_hostname_validation.h              |    81 +
92
 include/proto.h                                    |    68 +
93
 include/resource.h                                 |    59 +
94
 include/setup.h.in                                 |   219 +
95
 include/struct.h                                   |  2159 ++++
96
 include/sys.h                                      |   227 +
97
 include/types.h                                    |    43 +
98
 include/unrealircd.h                               |    37 +
99
 include/url.h                                      |    13 +
100
 include/version.h                                  |    72 +
101
 include/whowas.h                                   |    71 +
102
 include/windows/setup.h                            |    72 +
103
 src/Makefile.in                                    |   246 +
104
 src/aliases.c                                      |   287 +
105
 src/api-channelmode.c                              |   549 +
106
 src/api-clicap.c                                   |   372 +
107
 src/api-command.c                                  |   285 +
108
 src/api-efunctions.c                               |   366 +
109
 src/api-event.c                                    |   211 +
110
 src/api-extban.c                                   |   299 +
111
 src/api-history-backend.c                          |   197 +
112
 src/api-isupport.c                                 |   335 +
113
 src/api-messagetag.c                               |   176 +
114
 src/api-moddata.c                                  |   465 +
115
 src/api-usermode.c                                 |   507 +
116
 src/auth.c                                         |   567 +
117
 src/buildmod                                       |    19 +
118
 src/channel.c                                      |  1367 +++
119
 src/conf.c                                         | 10569 +++++++++++++++++++
120
 src/conf_preprocessor.c                            |   534 +
121
 src/crashreport.c                                  |   890 ++
122
 src/crule.c                                        |   785 ++
123
 src/crypt_blowfish.c                               |   907 ++
124
 src/dbuf.c                                         |   190 +
125
 src/debug.c                                        |   160 +
126
 src/dispatch.c                                     |   638 ++
127
 src/dns.c                                          |   742 ++
128
 src/fdlist.c                                       |   199 +
129
 src/hash.c                                         |  1026 ++
130
 src/ircd.c                                         |  1525 +++
131
 src/ircsprintf.c                                   |   215 +
132
 src/list.c                                         |   569 +
133
 src/macosx/UnrealIRCd.xcodeproj/project.pbxproj    |   463 +
134
 .../project.xcworkspace/contents.xcworkspacedata   |     7 +
135
 src/macosx/UnrealIRCd/AppDelegate.swift            |    55 +
136
 src/macosx/UnrealIRCd/AppModel.swift               |    86 +
137
 src/macosx/UnrealIRCd/Base.lproj/Main.storyboard   |   155 +
138
 src/macosx/UnrealIRCd/ChangeNotifier.swift         |    46 +
139
 src/macosx/UnrealIRCd/ConfigurationModel.swift     |    41 +
140
 src/macosx/UnrealIRCd/DaemonModel.swift            |    40 +
141
 .../AppIcon.appiconset/Contents.json               |    58 +
142
 src/macosx/UnrealIRCd/Info.plist                   |    36 +
143
 src/macosx/UnrealIRCd/ViewController.swift         |    87 +
144
 src/macosx/UnrealIRCd/WindowController.swift       |    23 +
145
 src/macosx/UnrealIRCd/logo.png                     |   Bin 0 -> 1444 bytes
146
 src/macosx/UnrealIRCd/logo@2x.png                  |   Bin 0 -> 1932 bytes
147
 src/macosx/UnrealIRCdTests/Info.plist              |    24 +
148
 src/macosx/UnrealIRCdTests/UnrealIRCdTests.swift   |    36 +
149
 src/match.c                                        |   865 ++
150
 src/mempool.c                                      |   745 ++
151
 src/misc.c                                         |  1914 ++++
152
 src/modulemanager.c                                |  1692 +++
153
 src/modules.c                                      |  1454 +++
154
 src/modules/Makefile.in                            |   647 ++
155
 src/modules/account-notify.c                       |    76 +
156
 src/modules/account-tag.c                          |    98 +
157
 src/modules/addmotd.c                              |    88 +
158
 src/modules/addomotd.c                             |    88 +
159
 src/modules/admin.c                                |    86 +
160
 src/modules/antimixedutf8.c                        |   344 +
161
 src/modules/antirandom.c                           |  1003 ++
162
 src/modules/authprompt.c                           |   479 +
163
 src/modules/away.c                                 |   147 +
164
 src/modules/batch.c                                |   120 +
165
 src/modules/blacklist.c                            |   841 ++
166
 src/modules/botmotd.c                              |    90 +
167
 src/modules/cap.c                                  |   419 +
168
 src/modules/certfp.c                               |   157 +
169
 src/modules/chanmodes/Makefile.in                  |   129 +
170
 src/modules/chanmodes/censor.c                     |   335 +
171
 src/modules/chanmodes/delayjoin.c                  |   386 +
172
 src/modules/chanmodes/floodprot.c                  |  1490 +++
173
 src/modules/chanmodes/history.c                    |   537 +
174
 src/modules/chanmodes/issecure.c                   |   278 +
175
 src/modules/chanmodes/link.c                       |   439 +
176
 src/modules/chanmodes/nocolor.c                    |   142 +
177
 src/modules/chanmodes/noctcp.c                     |    89 +
178
 src/modules/chanmodes/noinvite.c                   |    99 +
179
 src/modules/chanmodes/nokick.c                     |    85 +
180
 src/modules/chanmodes/noknock.c                    |   105 +
181
 src/modules/chanmodes/nonickchange.c               |    81 +
182
 src/modules/chanmodes/nonotice.c                   |    89 +
183
 src/modules/chanmodes/operonly.c                   |   108 +
184
 src/modules/chanmodes/permanent.c                  |    97 +
185
 src/modules/chanmodes/regonly.c                    |    77 +
186
 src/modules/chanmodes/regonlyspeak.c               |   108 +
187
 src/modules/chanmodes/secureonly.c                 |   201 +
188
 src/modules/chanmodes/stripcolor.c                 |   131 +
189
 src/modules/channeldb.c                            |   499 +
190
 src/modules/charsys.c                              |  1233 +++
191
 src/modules/chghost.c                              |   157 +
192
 src/modules/chgident.c                             |   153 +
193
 src/modules/chgname.c                              |   127 +
194
 src/modules/cloak.c                                |   419 +
195
 src/modules/close.c                                |    81 +
196
 src/modules/connect.c                              |   155 +
197
 src/modules/connthrottle.c                         |   636 ++
198
 src/modules/cycle.c                                |    81 +
199
 src/modules/dccallow.c                             |   252 +
200
 src/modules/dccdeny.c                              |   862 ++
201
 src/modules/echo-message.c                         |    91 +
202
 src/modules/eos.c                                  |    75 +
203
 src/modules/extbans/Makefile.in                    |   104 +
204
 src/modules/extbans/account.c                      |    92 +
205
 src/modules/extbans/certfp.c                       |   125 +
206
 src/modules/extbans/inchannel.c                    |   163 +
207
 src/modules/extbans/join.c                         |    78 +
208
 src/modules/extbans/msgbypass.c                    |   224 +
209
 src/modules/extbans/nickchange.c                   |    81 +
210
 src/modules/extbans/operclass.c                    |   104 +
211
 src/modules/extbans/partmsg.c                      |    71 +
212
 src/modules/extbans/quiet.c                        |    77 +
213
 src/modules/extbans/realname.c                     |    97 +
214
 src/modules/extbans/textban.c                      |   499 +
215
 src/modules/extbans/timedban.c                     |   505 +
216
 src/modules/globops.c                              |    87 +
217
 src/modules/help.c                                 |   145 +
218
 src/modules/hideserver.c                           |   395 +
219
 src/modules/history.c                              |   125 +
220
 src/modules/history_backend_mem.c                  |   446 +
221
 src/modules/history_backend_null.c                 |    75 +
222
 src/modules/ident_lookup.c                         |   254 +
223
 src/modules/invite.c                               |   302 +
224
 src/modules/ircops.c                               |   141 +
225
 src/modules/ison.c                                 |   104 +
226
 src/modules/join.c                                 |   811 ++
227
 src/modules/jointhrottle.c                         |   306 +
228
 src/modules/jumpserver.c                           |   266 +
229
 src/modules/kick.c                                 |   373 +
230
 src/modules/kill.c                                 |   190 +
231
 src/modules/knock.c                                |   169 +
232
 src/modules/labeled-response.c                     |   368 +
233
 src/modules/lag.c                                  |    85 +
234
 src/modules/link-security.c                        |   281 +
235
 src/modules/links.c                                |    77 +
236
 src/modules/list.c                                 |   484 +
237
 src/modules/locops.c                               |    76 +
238
 src/modules/lusers.c                               |    94 +
239
 src/modules/map.c                                  |   173 +
240
 src/modules/md.c                                   |   438 +
241
 src/modules/mdex.c                                 |   317 +
242
 src/modules/message-ids.c                          |   166 +
243
 src/modules/message-tags.c                         |   306 +
244
 src/modules/message.c                              |   819 ++
245
 src/modules/mkpasswd.c                             |   106 +
246
 src/modules/mode.c                                 |  1937 ++++
247
 src/modules/module.def                             |     5 +
248
 src/modules/motd.c                                 |   123 +
249
 src/modules/names.c                                |   201 +
250
 src/modules/netinfo.c                              |   141 +
251
 src/modules/nick.c                                 |  1416 +++
252
 src/modules/nocodes.c                              |   102 +
253
 src/modules/oper.c                                 |   332 +
254
 src/modules/opermotd.c                             |    92 +
255
 src/modules/part.c                                 |   220 +
256
 src/modules/pass.c                                 |   141 +
257
 src/modules/pingpong.c                             |   200 +
258
 src/modules/plaintext-policy.c                     |    75 +
259
 src/modules/protoctl.c                             |   420 +
260
 src/modules/quit.c                                 |   163 +
261
 src/modules/reputation.c                           |   885 ++
262
 src/modules/require-module.c                       |   558 +
263
 src/modules/restrict-commands.c                    |   408 +
264
 src/modules/rmtkl.c                                |   293 +
265
 src/modules/rules.c                                |    92 +
266
 src/modules/sajoin.c                               |   279 +
267
 src/modules/samode.c                               |    86 +
268
 src/modules/sapart.c                               |   164 +
269
 src/modules/sasl.c                                 |   445 +
270
 src/modules/sdesc.c                                |    92 +
271
 src/modules/sendsno.c                              |   103 +
272
 src/modules/sendumode.c                            |   107 +
273
 src/modules/server-time.c                          |   116 +
274
 src/modules/server.c                               |  1284 +++
275
 src/modules/sethost.c                              |   152 +
276
 src/modules/setident.c                             |   131 +
277
 src/modules/setname.c                              |   118 +
278
 src/modules/silence.c                              |   240 +
279
 src/modules/sinfo.c                                |   163 +
280
 src/modules/sjoin.c                                |   906 ++
281
 src/modules/snomasks/Makefile.in                   |    55 +
282
 src/modules/snomasks/dccreject.c                   |    70 +
283
 src/modules/sqline.c                               |    87 +
284
 src/modules/squit.c                                |   158 +
285
 src/modules/staff.c                                |   389 +
286
 src/modules/starttls.c                             |   122 +
287
 src/modules/stats.c                                |  1076 ++
288
 src/modules/sts.c                                  |   111 +
289
 src/modules/svsjoin.c                              |    97 +
290
 src/modules/svskill.c                              |    88 +
291
 src/modules/svslusers.c                            |    79 +
292
 src/modules/svsmode.c                              |   607 ++
293
 src/modules/svsmotd.c                              |   118 +
294
 src/modules/svsnick.c                              |   115 +
295
 src/modules/svsnline.c                             |   157 +
296
 src/modules/svsnolag.c                             |   105 +
297
 src/modules/svsnoop.c                              |    95 +
298
 src/modules/svspart.c                              |    90 +
299
 src/modules/svssilence.c                           |    96 +
300
 src/modules/svssno.c                               |   133 +
301
 src/modules/svswatch.c                             |    80 +
302
 src/modules/swhois.c                               |   110 +
303
 src/modules/third/Makefile.in                      |    47 +
304
 src/modules/time.c                                 |    66 +
305
 src/modules/tkl.c                                  |  4955 +++++++++
306
 src/modules/tkldb.c                                |   699 ++
307
 src/modules/tls_antidos.c                          |   112 +
308
 src/modules/topic.c                                |   281 +
309
 src/modules/trace.c                                |   234 +
310
 src/modules/tsctl.c                                |    72 +
311
 src/modules/umode2.c                               |    74 +
312
 src/modules/unsqline.c                             |    74 +
313
 src/modules/user.c                                 |   115 +
314
 src/modules/userhost-tag.c                         |   111 +
315
 src/modules/userhost.c                             |   113 +
316
 src/modules/userip-tag.c                           |   111 +
317
 src/modules/userip.c                               |   125 +
318
 src/modules/usermodes/Makefile.in                  |    91 +
319
 src/modules/usermodes/bot.c                        |    97 +
320
 src/modules/usermodes/censor.c                     |   270 +
321
 src/modules/usermodes/noctcp.c                     |    85 +
322
 src/modules/usermodes/nokick.c                     |   100 +
323
 src/modules/usermodes/privacy.c                    |    69 +
324
 src/modules/usermodes/privdeaf.c                   |    59 +
325
 src/modules/usermodes/regonlymsg.c                 |    72 +
326
 src/modules/usermodes/secureonlymsg.c              |    86 +
327
 src/modules/usermodes/servicebot.c                 |   143 +
328
 src/modules/usermodes/showwhois.c                  |    76 +
329
 src/modules/vhost.c                                |   172 +
330
 src/modules/wallops.c                              |    77 +
331
 src/modules/watch.c                                |   266 +
332
 src/modules/webirc.c                               |   498 +
333
 src/modules/webredir.c                             |   201 +
334
 src/modules/websocket.c                            |   786 ++
335
 src/modules/who_old.c                              |   865 ++
336
 src/modules/whois.c                                |   349 +
337
 src/modules/whowas.c                               |   113 +
338
 src/modules/whox.c                                 |   944 ++
339
 src/numeric.c                                      |  1056 ++
340
 src/openssl_hostname_validation.c                  |   402 +
341
 src/operclass.c                                    |   344 +
342
 src/parse.c                                        |   747 ++
343
 src/random.c                                       |   522 +
344
 src/scache.c                                       |    99 +
345
 src/send.c                                         |  1202 +++
346
 src/serv.c                                         |  1281 +++
347
 src/socket.c                                       |  1534 +++
348
 src/support.c                                      |  1306 +++
349
 src/tls.c                                          |  1354 +++
350
 src/updconf.c                                      |  1730 +++
351
 src/url.c                                          |   458 +
352
 src/user.c                                         |   701 ++
353
 src/utf8.c                                         |   223 +
354
 src/version.c.SH                                   |   275 +
355
 src/whowas.c                                       |   186 +
356
 src/windows/Icon1.ico                              |   Bin 0 -> 18718 bytes
357
 src/windows/UnrealIRCd.exe.manifest                |    22 +
358
 src/windows/bar.bmp                                |   Bin 0 -> 13270 bytes
359
 src/windows/compilerhelp.c                         |    55 +
360
 src/windows/config.c                               |    56 +
361
 src/windows/def-clean.c                            |    39 +
362
 src/windows/editor.c                               |   769 ++
363
 src/windows/gpl.rtf                                |    97 +
364
 src/windows/gplplusssl.rtf                         |   196 +
365
 src/windows/gui.c                                  |  1122 ++
366
 src/windows/hand.CUR                               |   Bin 0 -> 326 bytes
367
 src/windows/makecert.bat                           |     6 +
368
 src/windows/resource.h                             |   108 +
369
 src/windows/rtf.c                                  |   878 ++
370
 src/windows/service.c                              |   148 +
371
 src/windows/toolbar.bmp                            |   Bin 0 -> 822 bytes
372
 src/windows/unreal.bmp                             |   Bin 0 -> 80826 bytes
373
 src/windows/unrealinst.iss                         |   193 +
374
 src/windows/unrealsvc.c                            |   212 +
375
 src/windows/unrealsvc.rc                           |    99 +
376
 src/windows/win.c                                  |   341 +
377
 src/windows/win.h                                  |    43 +
378
 src/windows/windebug.c                             |   370 +
379
 src/windows/wingui.rc                              |   415 +
380
 unrealircd.in                                      |   315 +
381
 374 files changed, 139378 insertions(+)
382
383
diff --git a/.gitignore b/.gitignore
384
new file mode 100644
385
index 0000000..46780c6
386
--- /dev/null
387
+++ b/.gitignore
388
@@ -0,0 +1,75 @@
389
+# Ignore configure step
390
+aclocal.m4
391
+autom4te.cache
392
+config.log
393
+conftest.*
394
+config.settings
395
+extras/pcre2*
396
+extras/c-ares*
397
+config.status
398
+extras/ircdcron/ircd.cron
399
+extras/ircdcron/ircdchk
400
+src/modules/snomasks/Makefile
401
+src/modules/chanmodes/Makefile
402
+src/modules/extbans/Makefile
403
+src/modules/usermodes/Makefile
404
+src/modules/Makefile
405
+src/modules/third/Makefile
406
+/Makefile
407
+/src/Makefile
408
+/unrealircd
409
+include/setup.h
410
+
411
+# Ignore tags file
412
+tags
413
+
414
+# Ignore editor files
415
+*\#*
416
+*~
417
+
418
+# Ignore SSL Stuff
419
+server.cert.pem
420
+server.key.pem
421
+server.req.pem
422
+tls.rnd
423
+
424
+# Ignores for platform stuff
425
+.DS_Store
426
+
427
+# Ignores for build artifacts
428
+*.so
429
+*.o
430
+*.dSYM
431
+*.dylib
432
+src/ircd
433
+src/version.c
434
+src/include
435
+
436
+# Ignores for mac stuff
437
+## Various settings
438
+*.pbxuser
439
+!default.pbxuser
440
+*.mode1v3
441
+!default.mode1v3
442
+*.mode2v3
443
+!default.mode2v3
444
+*.perspectivev3
445
+!default.perspectivev3
446
+xcuserdata
447
+
448
+## Other
449
+*.xccheckout
450
+*.moved-aside
451
+*.xcuserstate
452
+*.xcscmblueprint
453
+
454
+## Obj-C/Swift specific
455
+*.hmap
456
+*.ipa
457
+
458
+src/macosx/build/
459
+DerivedData
460
+src/macosx/pods/
461
+
462
+# Doxygen generated files
463
+doc/doxygen/
464
diff --git a/Config b/Config
465
new file mode 100755
466
index 0000000..28ccb7f
467
--- /dev/null
468
+++ b/Config
469
@@ -0,0 +1,793 @@
470
+#!/bin/sh
471
+#
472
+# Config script for UnrealIRCd
473
+# (C) 2001-2019 The UnrealIRCd Team
474
+#
475
+# This configure script is free software; the UnrealIRCd Team gives 
476
+# unlimited permission to copy, distribute and modify as long as the
477
+# copyright headers stay intact
478
+#
479
+#
480
+# Rewritten completely to be an interface to autoconf by codemastr
481
+# This was inspired by the config by Michael Graff (explorer@flame.org)
482
+# but was written from scratch
483
+
484
+# In order to be faster than the old Config, this assumes that all information
485
+# in the cache file is valid and therefore doesn't check it, so if you messed with
486
+# default values thats your problem :P
487
+
488
+# some bits edited by baafie on March 17 2004, every change marked.
489
+
490
+
491
+RUN_CONFIGURE () {
492
+ARG=" "
493
+
494
+if [ -z "$BINDIR" -o -z "$DATADIR" -o -z "$CONFDIR" -o -z "$MODULESDIR" -o -z "$LOGDIR" -o -z "$CACHEDIR" -o -z "$DOCDIR" -o -z "$TMPDIR" -o -z "$PRIVATELIBDIR" ]; then
495
+	echo "Sorry './Config -quick' cannot be used because your 'config.settings'"
496
+	echo "file either does not exist or is from an old UnrealIRCd version"
497
+	echo "(older than UnrealIRCd 5.0.0)."
498
+	echo ""
499
+	echo "Please run './Config' without -quick and answer all questions."
500
+	echo ""
501
+	exit
502
+fi
503
+
504
+
505
+mkdir -p $TMPDIR
506
+mkdir -p $PRIVATELIBDIR
507
+
508
+# Do this even if we're not in advanced mode
509
+if [ "$SHOWLISTMODES" = "1" ] ; then
510
+	ARG="$ARG--with-showlistmodes "
511
+fi
512
+if [ "$ADVANCED" = "1" ] ; then
513
+if [ "$NOOPEROVERRIDE" = "1" ] ; then
514
+	ARG="$ARG--with-no-operoverride "
515
+fi
516
+if [ "$OPEROVERRIDEVERIFY" = "1" ] ; then
517
+	ARG="$ARG--with-operoverride-verify "
518
+fi
519
+fi
520
+if test x"$SSLDIR" = "x" ; then
521
+ARG="$ARG--enable-ssl "
522
+else
523
+ARG="$ARG--enable-ssl=$SSLDIR "
524
+fi
525
+if [ "$REMOTEINC" = "1" ] ; then
526
+ARG="$ARG--enable-libcurl=$CURLDIR "
527
+fi
528
+if [ "$PREFIXAQ" != "1" ]; then
529
+ARG="$ARG--disable-prefixaq "
530
+fi
531
+if [ "$MAXCONNECTIONS_REQUEST" != "auto" ]; then
532
+	ARG="$ARG--with-maxconnections=$MAXCONNECTIONS_REQUEST "
533
+fi
534
+
535
+ARG="$ARG--with-bindir=$BINDIR "
536
+ARG="$ARG--with-datadir=$DATADIR "
537
+ARG="$ARG--with-pidfile=$DATADIR/unrealircd.pid "
538
+ARG="$ARG--with-confdir=$CONFDIR "
539
+ARG="$ARG--with-modulesdir=$MODULESDIR "
540
+ARG="$ARG--with-logdir=$LOGDIR "
541
+ARG="$ARG--with-cachedir=$CACHEDIR "
542
+ARG="$ARG--with-docdir=$DOCDIR "
543
+ARG="$ARG--with-tmpdir=$TMPDIR "
544
+ARG="$ARG--with-privatelibdir=$PRIVATELIBDIR "
545
+ARG="$ARG--with-scriptdir=$BASEPATH "
546
+ARG="$ARG--with-nick-history=$NICKNAMEHISTORYLENGTH "
547
+ARG="$ARG--with-permissions=$DEFPERM "
548
+ARG="$ARG--enable-dynamic-linking "
549
+ARG="$ARG $EXTRAPARA "
550
+CONF="./configure $ARG"
551
+# remove possibly old instances of curl in ~/unrealircd/lib/
552
+rm -f $PRIVATELIBDIR/*curl* 1>/dev/null 2>&1
553
+# Ensure we install curl even if someone does ./Config -quick...
554
+if [ "x$CURLDIR" = "x$UNREALCWD/extras/curl" ]; then
555
+	INSTALLCURL=1
556
+fi
557
+if [ "x$INSTALLCURL" = "x1" ]; then
558
+	extras/curlinstall "$PRIVATELIBDIR" || exit 1
559
+fi
560
+echo $CONF
561
+$CONF || exit 1
562
+cd "$UNREALCWD"
563
+if [  "$QUICK" != "1" ] ; then
564
+if [ ! -f $CONFDIR/tls/server.cert.pem -a ! -f $CONFDIR/ssl/server.cert.pem ]; then
565
+export OPENSSLPATH
566
+TEST=""
567
+while [ -z "$TEST" ] ; do
568
+    if [ "$GENCERTIFICATE" = "1" ] ; then
569
+	TEST="Yes"
570
+    else
571
+	TEST="No"
572
+    fi
573
+    echo ""
574
+    echo "Do you want to generate an SSL certificate for the IRCd?"
575
+    echo "Only answer No if you already have one."
576
+    echo $n "[$TEST] -> $c"
577
+	read cc
578
+    if [ -z "$cc" ] ; then
579
+	cc=$TEST
580
+    fi
581
+    case "$cc" in
582
+	[Yy]*)
583
+	    GENCERTIFICATE="1"
584
+	    ;;
585
+	[Nn]*)
586
+	    GENCERTIFICATE=""
587
+	    ;;
588
+	*)
589
+	    echo ""
590
+	    echo "You must enter either Yes or No"
591
+	    TEST=""
592
+	    ;;
593
+    esac
594
+done
595
+if [ "$GENCERTIFICATE" = 1 ]; then
596
+	make pem
597
+	echo "Certificate created successfully."
598
+	sleep 1
599
+else
600
+	echo "Ok, not generating SSL certificate. Make sure that the certificate and key"
601
+	echo "are installed in conf/tls/server.crt.pem and conf/tls/server.key.pem prior to starting the IRCd."
602
+fi
603
+else
604
+echo "SSL certificate already exists in configuration directory, no need to regenerate."
605
+fi
606
+fi
607
+
608
+# Silently force a 'make clean' as otherwise part (or whole) of the
609
+# compiled source could be using different settings than the user
610
+# just requested when re-running ./Config.
611
+make clean 1>/dev/null 2>&1
612
+}
613
+
614
+RUN_ADVANCED () {
615
+TEST=""
616
+while [ -z "$TEST" ] ; do
617
+    if [ "$SHOWLISTMODES" = "1" ] ; then
618
+	TEST="Yes"
619
+    else
620
+	TEST="No"
621
+    fi
622
+    echo ""
623
+    echo "Do you want to show the modes a channel has set in the /list output?"
624
+    echo $n "[$TEST] -> $c"
625
+	read cc
626
+    if [ -z "$cc" ] ; then
627
+	cc=$TEST
628
+    fi
629
+    case "$cc" in
630
+	[Yy]*)
631
+	    SHOWLISTMODES="1"
632
+	    ;;
633
+	[Nn]*)
634
+	    SHOWLISTMODES=""
635
+	    ;;
636
+	*)
637
+	    echo ""
638
+	    echo "You must enter either Yes or No"
639
+	    TEST=""
640
+	    ;;
641
+    esac
642
+done
643
+
644
+TEST=""
645
+while [ -z "$TEST" ] ; do
646
+    if [ "$NOOPEROVERRIDE" = "1" ] ; then
647
+	TEST="Yes"
648
+    else
649
+	TEST="No"
650
+    fi
651
+    echo ""
652
+    echo "Do you want to disable oper override?"
653
+    echo $n "[$TEST] -> $c"
654
+	read cc
655
+    if [ -z "$cc" ] ; then
656
+	cc=$TEST
657
+    fi
658
+    case "$cc" in
659
+	[Yy]*)
660
+	    NOOPEROVERRIDE="1"
661
+	    ;;
662
+	[Nn]*)
663
+	    NOOPEROVERRIDE=""
664
+	    ;;
665
+	*)
666
+	    echo ""
667
+	    echo "You must enter either Yes or No"
668
+	    TEST=""
669
+	    ;;
670
+    esac
671
+done
672
+
673
+TEST=""
674
+while [ -z "$TEST" ] ; do
675
+    if [ "$OPEROVERRIDEVERIFY" = "1" ] ; then
676
+	TEST="Yes"
677
+    else
678
+	TEST="No"
679
+    fi
680
+    echo ""
681
+    echo "Do you want to require opers to /invite themselves into a +s or +p channel?"
682
+    echo $n "[$TEST] -> $c"
683
+	read cc
684
+    if [ -z "$cc" ] ; then
685
+	cc=$TEST
686
+    fi
687
+    case "$cc" in
688
+	[Yy]*)
689
+	    OPEROVERRIDEVERIFY="1"
690
+	    ;;
691
+	[Nn]*)
692
+	    OPEROVERRIDEVERIFY=""
693
+	    ;;
694
+	*)
695
+	    echo ""
696
+	    echo "You must enter either Yes or No"
697
+	    TEST=""
698
+	    ;;
699
+    esac
700
+done
701
+
702
+}
703
+c=""
704
+n=""
705
+UNREALCWD="`pwd`"
706
+BASEPATH="$HOME/unrealircd"
707
+DEFPERM="0600"
708
+SSLDIR=""
709
+NICKNAMEHISTORYLENGTH="100"
710
+MAXCONNECTIONS_REQUEST="auto"
711
+REMOTEINC="1"
712
+CURLDIR=""
713
+PREFIXAQ="0"
714
+SHOWLISTMODES="0"
715
+NOOPEROVERRIDE=""
716
+OPEROVERRIDEVERIFY=""
717
+GENCERTIFICATE="1"
718
+EXTRAPARA=""
719
+if [ "`eval echo -n 'a'`" = "-n a" ] ; then
720
+        c="\c"
721
+else
722
+        n="-n"
723
+fi
724
+
725
+
726
+#parse arguments
727
+NOCACHE=""
728
+IMPORTEDSETTINGS=""
729
+NOINTRO=""
730
+QUICK=""
731
+CLEAN=""
732
+ADVANCED=""
733
+while [ $# -ge 1 ] ; do
734
+	if [ $1 = "--help" ] ; then
735
+		echo "Config utility for UnrealIRCd"
736
+		echo "-----------------------------"
737
+		echo "Syntax: ./Config [options]"
738
+		echo "-nocache     Ignore settings saved in config.settings"
739
+		echo "-nointro     Skip intro (release notes, etc)"
740
+		echo "-quick       Skip questions, go straight to configure"
741
+		echo "-advanced    Include additional advanced questions"
742
+		echo "-clean       Clean ./configure cache"
743
+		exit 0
744
+	elif [ $1 = "-nocache" ] ; then
745
+		NOCACHE="1"
746
+	elif [ $1 = "-nointro" ] ; then
747
+		NOINTRO="1"
748
+	elif [ $1 = "-quick" -o $1 = "-q" ] ; then
749
+		QUICK="1"
750
+		echo "running quick config"
751
+		if [ -f "config.settings" ] ; then
752
+			. ./config.settings
753
+		fi
754
+		RUN_CONFIGURE
755
+		cd "$UNREALCWD"
756
+		exit 0
757
+	elif [ $1 = "-clean" -o $1 = "-C" ] ; then
758
+		CLEAN="1"
759
+	elif [ $1 = "-advanced" ] ; then
760
+		PREADVANCED="1"
761
+	fi
762
+	shift 1
763
+done
764
+
765
+if [ "$PREADVANCED" = "1" ] ; then
766
+	ADVANCED="1"
767
+elif [ "$ADVANCED" = "1" ]; then
768
+	ADVANCED=""
769
+fi
770
+
771
+if [ -n "$CLEAN" ] ; then
772
+	rm -f config.cache
773
+fi
774
+
775
+if [ "`id -u`" = "0" ]; then
776
+	echo "ERROR: You cannot build or run UnrealIRCd as root"
777
+	echo ""
778
+	echo "Please create a separate account for building and running UnrealIRCd."
779
+	echo "See https://www.unrealircd.org/docs/Do_not_run_as_root"
780
+	exit
781
+fi
782
+
783
+clear
784
+
785
+    if [ -f "doc/Config.header" -a -z "$NOINTRO" ] ; then
786
+        more doc/Config.header
787
+        echo ""
788
+        echo $n "[Press Enter to continue]"
789
+        read cc
790
+        clear
791
+    fi
792
+
793
+echo "We will now ask you a number of questions. You can just press ENTER to accept the defaults!"
794
+echo ""
795
+
796
+if [ -z "$NOCACHE" ] ; then
797
+	# This needs to be updated each release so auto-upgrading works for settings, modules, etc!!:
798
+	UNREALRELEASES="unrealircd-5.0.2 unrealircd-5.0.1 unrealircd-5.0.0 unrealircd-5.0.0-rc2 unrealircd-5.0.0-rc1"
799
+	if [ -f "config.settings" ]; then
800
+		. ./config.settings
801
+	else
802
+		# Try to load a previous config.settings
803
+		for x in $UNREALRELEASES
804
+		do
805
+			if [ -f ../$x/config.settings ]; then
806
+				IMPORTEDSETTINGS="../$x"
807
+				break
808
+			fi
809
+		done
810
+		echo "If you have previously installed UnrealIRCd on this shell then you can specify a"
811
+		echo "directory here so I can import the build settings and third party modules"
812
+		echo "to make your life a little easier."
813
+		if [ ! -z "$IMPORTEDSETTINGS" ]; then
814
+			echo "Found previous installation in: $IMPORTEDSETTINGS."
815
+			echo "You can enter a different path or type 'none' if you don't want to use it."
816
+			echo "Just press Enter to accept the default settings."
817
+		else
818
+			echo "If you install UnrealIRCd for the first time on this shell, then just hit Enter";
819
+		fi
820
+
821
+		TEST="$IMPORTEDSETTINGS"
822
+		echo $n "[$TEST] -> $c"
823
+		read cc
824
+		if [ -z "$cc" ]; then
825
+			IMPORTEDSETTINGS="$TEST"
826
+		else
827
+			IMPORTEDSETTINGS="$cc"
828
+		fi
829
+		if [ "$IMPORTEDSETTINGS" = "none" ]; then
830
+			IMPORTEDSETTINGS=""
831
+		fi
832
+		if [ "$IMPORTEDSETTINGS" != "" ]; then
833
+			if [ -d $IMPORTEDSETTINGS/conf ]; then
834
+				echo "ERROR: Directory $IMPORTEDSETTINGS is an INSTALLATION directory (eg /home/irc/unrealircd)."
835
+				echo "This question was about a SOURCE directory (eg /home/irc/unrealircd-5.0.0)."
836
+				exit
837
+			fi
838
+			if [ ! -f $IMPORTEDSETTINGS/config.settings ]; then
839
+				echo "Directory $IMPORTEDSETTINGS does not exist or does not contain a config.settings file"
840
+				exit
841
+			fi
842
+			COPYMODULES="1"
843
+			if grep -q TOPICNICKISNUH $IMPORTEDSETTINGS/config.settings; then
844
+				echo "Directory $IMPORTEDSETTINGS seems to be UnrealIRCd 4.x (or older)."
845
+				echo "I will copy the settings but not any 3rd party modules, as they are incompatible with 5.x."
846
+				COPYMODULES="0"
847
+			fi
848
+			# Actually load the settings
849
+			. $IMPORTEDSETTINGS/config.settings
850
+			if [ "$COPYMODULES" = "1" ]; then
851
+				# Copy over 3rd party modules (also deals with 0 file cases, hence the silly looking code)
852
+				for f in $IMPORTEDSETTINGS/src/modules/third/*.c
853
+				do
854
+					[ -e "$f" ] && cp $f src/modules/third/
855
+				done
856
+			fi
857
+		fi
858
+	fi
859
+	# If we just imported settings and the curl dir is set to
860
+	# something like /home/xxx/unrealircd-5.x.y/extras/curl/
861
+	# (what we call 'local-curl') then remove this setting as
862
+	# it would refer to the old UnrealIRCd installation.
863
+	if [ ! -z "$IMPORTEDSETTINGS" ]; then
864
+		if echo "$CURLDIR"|grep -qi unrealircd; then
865
+			CURLDIR=""
866
+		fi
867
+	fi
868
+fi
869
+
870
+TEST="$BASEPATH"
871
+echo ""
872
+echo "In what directory do you want to install UnrealIRCd?"
873
+echo "(Note: UnrealIRCd 5 will need to be installed somewhere."
874
+echo " If this directory does not exist it will be created.)"
875
+echo $n "[$TEST] -> $c"
876
+read cc
877
+if [ -z "$cc" ] ; then
878
+   BASEPATH=$TEST
879
+else
880
+   BASEPATH=`eval echo $cc` # modified
881
+fi
882
+if [ "$BASEPATH" = "$UNREALCWD" ]; then
883
+	echo ""
884
+	echo "ERROR: The installation directory cannot be the same as the directory"
885
+	echo "       containing the source code ($UNREALCWD)."
886
+	echo " HINT: Usually the directory containing the source is $HOME/unrealircd-5.x.y"
887
+	echo "       and the installation directory you would need to enter is $HOME/unrealircd"
888
+	exit 1
889
+fi
890
+
891
+# TODO: For -advanced we could prompt the user.
892
+BINDIR="$BASEPATH/bin"
893
+DATADIR="$BASEPATH/data"
894
+CONFDIR="$BASEPATH/conf"
895
+MODULESDIR="$BASEPATH/modules"
896
+LOGDIR="$BASEPATH/logs"
897
+CACHEDIR="$BASEPATH/cache"
898
+DOCDIR="$BASEPATH/doc"
899
+TMPDIR="$BASEPATH/tmp"
900
+PRIVATELIBDIR="$BASEPATH/lib"
901
+
902
+TEST=""
903
+while [ -z "$TEST" ] ; do
904
+    TEST="$DEFPERM"
905
+    echo ""
906
+    echo "What should the default permissions for your configuration files be? (Set this to 0 to disable)"
907
+    echo "It is strongly recommended that you use 0600 to prevent unwanted reading of the file"
908
+    echo $n "[$TEST] -> $c"
909
+	read cc
910
+    if [ -z "$cc" ] ; then
911
+	DEFPERM=$TEST
912
+	break
913
+    fi
914
+    case "$cc" in
915
+	[0-9]*)
916
+	    DEFPERM="$cc"
917
+	    ;;
918
+	*)
919
+	    echo ""
920
+	    echo "You must enter a number"
921
+	    TEST=""
922
+	    ;;
923
+    esac
924
+
925
+done
926
+
927
+
928
+
929
+
930
+echo ""
931
+echo "If you want, you can manually enter the path to OpenSSL/LibreSSL here."
932
+echo "In most cases you can leave this blank and it will be detected automatically."
933
+
934
+if [ -z "$SSLDIR" ]; then
935
+	uname|grep -q Darwin
936
+	if [ "$?" = 0 ]; then
937
+		echo "Looks like you're on a Mac - El Capitan and higher require"
938
+		echo "a 3rd party OpenSSL installation. We recommend using homebrew"
939
+		echo "to install OpenSSL, but you may install it any other way as well."
940
+		echo "We are selecting the default homebrew OpenSSL path - but you can"
941
+		echo "change it to another path if you have installed OpenSSL another way"
942
+		SSLDIR="/usr/local/opt/openssl/"
943
+	fi
944
+fi
945
+
946
+TEST="$SSLDIR"
947
+echo $n "[$TEST] -> $c"
948
+    read cc
949
+if [ -z "$cc" ] ; then
950
+    SSLDIR="$TEST"
951
+else 
952
+    SSLDIR=`eval echo $cc` # modified
953
+fi
954
+
955
+TEST=""
956
+while [ -z "$TEST" ] ; do
957
+    if [ "$REMOTEINC" = "1" ] ; then
958
+	TEST="Yes"
959
+    else
960
+	TEST="No"
961
+    fi
962
+    echo ""
963
+    echo "Do you want to enable remote includes?"
964
+    echo "This allows stuff like this in your configuration file:"
965
+    echo "include \"http://www.somesite.org/files/opers.conf\";"
966
+    echo $n "[$TEST] -> $c"
967
+	read cc
968
+    if [ -z "$cc" ] ; then
969
+	cc=$TEST
970
+    fi
971
+    case "$cc" in
972
+	[Yy]*)
973
+	    REMOTEINC="1"
974
+	    ;;
975
+	[Nn]*)
976
+	    REMOTEINC=""
977
+	    CURLDIR=""
978
+	    ;;
979
+	*)
980
+	    echo ""
981
+	    echo "You must enter either Yes or No"
982
+	    TEST=""
983
+	    ;;
984
+    esac
985
+done
986
+
987
+if [ "$REMOTEINC" = "1" ] ; then
988
+	if [ ! -d "$CURLDIR" ]; then
989
+		# Reset any previous CURLDIR if it doesn't exist (anymore)
990
+		CURLDIR=""
991
+	fi
992
+
993
+	INSTALLCURL="0"
994
+	SUGGESTCURLDIR=""
995
+
996
+	if [ -d "/usr/local/include/curl" ]; then
997
+		SUGGESTCURLDIR="/usr/local"
998
+	fi
999
+	if [ -d "/usr/include/curl" ]; then