summaryrefslogtreecommitdiff
path: root/net-dialup/ppp/files/ppp-2.4.9-fix-clang-nested-functions.patch
blob: 0a089e95430d39849dec2ada3d59c684c8e818c3 (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
https://github.com/ppp-project/ppp/commit/6e6a48fe628b76ec368277fd52685428e3dc8766
https://bugs.gentoo.org/831305

From: =?UTF-8?q?Eivind=20N=C3=A6ss?= <eivnaes@yahoo.com>
Date: Sun, 11 Jul 2021 14:36:44 -0700
Subject: [PATCH] Compiling with clang encounters an error in eap-tls.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This moves the inline functions to outside the function and declares them static.

Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
--- a/pppd/eap-tls.c
+++ b/pppd/eap-tls.c
@@ -285,6 +285,23 @@ ENGINE *eaptls_ssl_load_engine( char *engine_name )
 #endif
 
 
+#ifndef OPENSSL_NO_ENGINE
+static int eaptls_UI_writer(UI *ui, UI_STRING *uis)
+{
+    PW_CB_DATA* cb_data = (PW_CB_DATA*)UI_get0_user_data(ui);
+    UI_set_result(ui, uis, cb_data->password);
+    return 1;
+}
+
+static int eaptls_UI_stub(UI* ui) {
+    return 1;
+}
+
+static int eaptls_UI_reader(UI *ui, UI_STRING *uis) {
+    return 1;
+}
+#endif
+
 /*
  * Initialize the SSL stacks and tests if certificates, key and crl
  * for client or server use can be loaded.
@@ -578,20 +595,11 @@ SSL_CTX *eaptls_init_ssl(int init_server, char *cacertfile, char *capath,
         {
             UI_METHOD* transfer_pin = UI_create_method("transfer_pin");
 
-            int writer (UI *ui, UI_STRING *uis)
-            {
-                PW_CB_DATA* cb_data = (PW_CB_DATA*)UI_get0_user_data(ui);
-                UI_set_result(ui, uis, cb_data->password);
-                return 1;
-            };
-            int stub (UI* ui) {return 1;};
-            int stub_reader (UI *ui, UI_STRING *uis) {return 1;};
-
-            UI_method_set_writer(transfer_pin,  writer);
-            UI_method_set_opener(transfer_pin,  stub);
-            UI_method_set_closer(transfer_pin,  stub);
-            UI_method_set_flusher(transfer_pin, stub);
-            UI_method_set_reader(transfer_pin,  stub_reader);
+            UI_method_set_writer(transfer_pin,  eaptls_UI_writer);
+            UI_method_set_opener(transfer_pin,  eaptls_UI_stub);
+            UI_method_set_closer(transfer_pin,  eaptls_UI_stub);
+            UI_method_set_flusher(transfer_pin, eaptls_UI_stub);
+            UI_method_set_reader(transfer_pin,  eaptls_UI_reader);
 
             dbglog( "Using our private key URI: '%s' in engine", privkeyfile );
             pkey = ENGINE_load_private_key(pkey_engine, privkeyfile, transfer_pin, &cb_data);