Skip to contentSkip to conversation

Reformat files using uncrustify

PATCH In review Arne Schwabe 2 participants 2 messages Jun 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Reformat files using uncrustify

Some of the commits, especially engine have not strictly used uncrustify clean code. Rerun uncrustify to make them compliant again.

---
 src/openvpn/crypto_openssl.c                |  18 ++-
 src/openvpn/crypto_openssl.h                |   8 +-
 src/openvpn/helper.c                        |   1 -
 src/openvpn/manage.h                        |   2 +-
 src/openvpn/multi.c                         |   4 +-
 src/openvpn/options.c                       |  10 +-
 src/openvpn/otime.c                         |   4 +-
 src/openvpn/pool.c                          |  26 +--
 src/openvpn/push.c                          |   2 +-
 src/openvpn/ssl.c                           |   3 +-
 tests/unit_tests/engine-key/libtestengine.c | 167 +++++++++++---------
 11 files changed, 134 insertions(+), 111 deletions(-)
src/openvpn/crypto_openssl.c +12 -6
index 521cfca1..161a189e 100644
@@ -1083,7 +1083,8 @@ ui_reader(UI *ui, UI_STRING *uis)
 {
     SSL_CTX *ctx = UI_get0_user_data(ui);
 
-    if (UI_get_string_type(uis) == UIT_PROMPT) {
+    if (UI_get_string_type(uis) == UIT_PROMPT)
+    {
         pem_password_cb *cb = SSL_CTX_get_default_passwd_cb(ctx);
         void *d = SSL_CTX_get_default_passwd_cb_userdata(ctx);
         char password[64];
@@ -1105,14 +1106,17 @@ engine_load_key(const char *file, SSL_CTX *ctx)
     EVP_PKEY *pkey;
 
     if (!engine_persist)
+    {
         return NULL;
+    }
 
     /* this will print out the error from BIO_read */
     crypto_msg(M_INFO, "PEM_read_bio failed, now trying engine method to load private key");
 
     ui = UI_create_method("openvpn");
-    if (!ui) {
-	crypto_msg(M_FATAL, "Engine UI creation failed");
+    if (!ui)
+    {
+        crypto_msg(M_FATAL, "Engine UI creation failed");
         return NULL;
     }
 
@@ -1122,13 +1126,15 @@ engine_load_key(const char *file, SSL_CTX *ctx)
     pkey = ENGINE_load_private_key(engine_persist, file, ui, ctx);
     ENGINE_finish(engine_persist);
     if (!pkey)
-	crypto_msg(M_FATAL, "Engine could not load key file");
+    {
+        crypto_msg(M_FATAL, "Engine could not load key file");
+    }
 
     UI_destroy_method(ui);
     return pkey;
-#else
+#else  /* if HAVE_OPENSSL_ENGINE */
     return NULL;
-#endif
+#endif /* if HAVE_OPENSSL_ENGINE */
 }
 
 #endif /* ENABLE_CRYPTO_OPENSSL */
src/openvpn/crypto_openssl.h +4 -4
index 7449fbd3..4694ee08 100644
@@ -110,11 +110,11 @@ cipher_kt_var_key_size(const cipher_kt_t *cipher)
 /**
  * Load a key file from an engine
  *
- * @param file	The engine file to load
- * @param ui	The UI method for the password prompt
- * @param data	The data to pass to the UI method
+ * @param file  The engine file to load
+ * @param ui    The UI method for the password prompt
+ * @param data  The data to pass to the UI method
  *
- * @return	The private key if successful or NULL if not
+ * @return      The private key if successful or NULL if not
  */
 EVP_PKEY *
 engine_load_key(const char *file, SSL_CTX *ctx);
src/openvpn/helper.c +0 -1
index 2cc579e7..6e9cc63c 100644
@@ -478,7 +478,6 @@ helper_client_server(struct options *o)
         }
     }
     else
-
     /*
      * HELPER DIRECTIVE:
      *
src/openvpn/manage.h +1 -1
index 8c824ca7..881bfb14 100644
@@ -439,7 +439,7 @@ void management_notify_client_cr_response(unsigned mda_key_id,
                                           const struct env_set *es,
                                           const char *response);
 
-#endif
+#endif /* ifdef MANAGEMENT_DEF_AUTH */
 
 char *management_query_pk_sig(struct management *man, const char *b64_data,
                               const char *algorithm);
src/openvpn/multi.c +2 -2
index fe8fcd50..95b16744 100644
@@ -3320,8 +3320,8 @@ management_kill_by_cid(void *arg, const unsigned long cid, const char *kill_msg)
 
 static bool
 management_client_pending_auth(void *arg,
-        const unsigned long cid,
-        const char *extra)
+                               const unsigned long cid,
+                               const char *extra)
 {
     struct multi_context *m = (struct multi_context *) arg;
     struct multi_instance *mi = lookup_by_cid(m, cid);
src/openvpn/options.c +5 -5
index 3484f7d4..5f658d3f 100644
@@ -4978,11 +4978,11 @@ options_string_import(struct options *options,
 #if P2MP
 
 #define VERIFY_PERMISSION(mask) {                                            \
-    if (!verify_permission(p[0], file, line, (mask), permission_mask,        \
-                           option_types_found, msglevel, options, is_inline))\
-    {                                                                        \
-        goto err;                                                            \
-    }                                                                        \
+        if (!verify_permission(p[0], file, line, (mask), permission_mask,        \
+                               option_types_found, msglevel, options, is_inline)) \
+        {                                                                        \
+            goto err;                                                            \
+        }                                                                        \
 }
 
 static bool
src/openvpn/otime.c +2 -2
index b7eb1edc..640168a9 100644
@@ -130,8 +130,8 @@ time_string(time_t t, int usec, bool show_usec, struct gc_arena *gc)
     struct tm *tm = localtime(&t);
 
     buf_printf(&out, "%04d-%02d-%02d %02d:%02d:%02d",
-                tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
-                tm->tm_hour, tm->tm_min, tm->tm_sec);
+               tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
+               tm->tm_hour, tm->tm_min, tm->tm_sec);
 
     if (show_usec && tv.tv_usec)
     {
src/openvpn/pool.c +14 -12
index 370f6af7..1f74ac57 100644
@@ -310,20 +310,20 @@ ifconfig_pool_acquire(struct ifconfig_pool *pool, in_addr_t *local, in_addr_t *r
             switch (pool->ipv4.type)
             {
                 case IFCONFIG_POOL_30NET:
-                    {
-                        in_addr_t b = pool->ipv4.base + (i << 2);
-                        *local = b + 1;
-                        *remote = b + 2;
-                        break;
-                    }
+                {
+                    in_addr_t b = pool->ipv4.base + (i << 2);
+                    *local = b + 1;
+                    *remote = b + 2;
+                    break;
+                }
 
                 case IFCONFIG_POOL_INDIV:
-                    {
-                        in_addr_t b = pool->ipv4.base + i;
-                        *local = 0;
-                        *remote = b;
-                        break;
-                    }
+                {
+                    in_addr_t b = pool->ipv4.base + i;
+                    *local = 0;
+                    *remote = b;
+                    break;
+                }
 
                 default:
                     ASSERT(0);
@@ -683,7 +683,9 @@ ifconfig_pool_read(struct ifconfig_pool_persist *persist, struct ifconfig_pool *
                      * was not valid
                      */
                     if (h < 0)
+                    {
                         h = h6;
+                    }
                 }
             }
 
src/openvpn/push.c +1 -1
index 26460490..369cd6a4 100644
@@ -288,7 +288,7 @@ send_auth_failed(struct context *c, const char *client_reason)
 }
 
 bool
-send_auth_pending_messages(struct context *c, const char* extra)
+send_auth_pending_messages(struct context *c, const char *extra)
 {
     send_control_channel_string(c, "AUTH_PENDING", D_PUSH);
 
src/openvpn/ssl.c +2 -1
index 68d2b5c1..1cf8e44f 100644
@@ -1930,7 +1930,8 @@ tls_session_generate_data_channel_keys(struct tls_session *session)
     const struct session_id *server_sid = !session->opt->server ?
                                           &ks->session_id_remote : &session->session_id;
 
-    if (!ks->authenticated) {
+    if (!ks->authenticated)
+    {
         msg(D_TLS_ERRORS, "TLS Error: key_state not authenticated");
         goto cleanup;
     }
tests/unit_tests/engine-key/libtestengine.c +91 -76

184 lines not on this page · raw message

Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw

Verified that this is all whitespace. "The usual". I'll add a new commit to update .git-blame-ignore-revs with this commit (which needs to be an extra commit, recursion for beginners :-))

Sorry for those that I caused or ACKed...

I left out the hunk to option.c since that was in "asymmetric compression v5" already.

Your patch has been applied to the master branch.

commit c1ff8f247f91c88a2df5502eeedf42857f9a6831

Author: Arne Schwabe
Date:   Fri Jun 26 14:53:32 2020 +0200
     Reformat files using uncrustify

     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg20142.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering