[PATCH 1/2] build: rename '--enable-mbim-proxy-username' to '--enable-mbim-username'

Roshan Pius rpius at chromium.org
Fri Nov 14 16:58:56 PST 2014


This shouldn't be a proxy-only setting. We're going to chown the MBIM devices to
this specific user, so we'll re-use this setting for that as well.

---
 configure.ac                  | 25 +++++++++++--------------
 src/libmbim-glib/mbim-proxy.c | 12 ++++++------
 2 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3e0ede2..ae04f5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,16 +96,11 @@ AC_SUBST(GLIB_MKENUMS)
 dnl Documentation
 GTK_DOC_CHECK(1.0)
 
-# MBIM proxy UID
-AC_ARG_ENABLE(mbim-proxy-username,
-              AS_HELP_STRING([--enable-mbim-proxy-username=<username>], [where mbim proxy username is]),
-              mbim_proxy_username=$enableval,
-              mbim_proxy_username="")
-if ! test x"$mbim_proxy_username" = x""; then
-  AC_DEFINE_UNQUOTED(MBIM_PROXY_USERNAME, $mbim_proxy_username, [Define the MBIM Proxy username])
-else
-  AC_DEFINE(MBIM_PROXY_USERNAME, "root", [Define the MBIM Proxy username])
-fi
+# MBIM username
+AC_ARG_ENABLE(mbim-username,
+              AS_HELP_STRING([--enable-mbim-username=<username>], [user allowed to access MBIM devices]),,
+              enable_mbim_username="root")
+AC_DEFINE_UNQUOTED(MBIM_USERNAME, "$enable_mbim_username", [Define the MBIM username])
 
 dnl Man page
 AC_PATH_PROG(HELP2MAN, help2man, false)
@@ -137,8 +132,10 @@ echo "
     libmbim $VERSION
     ==============================================
 
-    compiler:                ${CC}
-    cflags:                  ${CFLAGS}
-    Maintainer mode:         ${USE_MAINTAINER_MODE}
-    Documentation:           ${enable_gtk_doc}
+    compiler:         ${CC}
+    cflags:           ${CFLAGS}
+    Maintainer mode:  ${USE_MAINTAINER_MODE}
+    Documentation:    ${enable_gtk_doc}
+    MBIM username:    ${enable_mbim_username}
+
 "
diff --git a/src/libmbim-glib/mbim-proxy.c b/src/libmbim-glib/mbim-proxy.c
index d3d32e0..fc69cd7 100644
--- a/src/libmbim-glib/mbim-proxy.c
+++ b/src/libmbim-glib/mbim-proxy.c
@@ -1064,9 +1064,9 @@ incoming_cb (GSocketService *service,
         return;
     }
 
-    expected_usr = getpwnam (MBIM_PROXY_USERNAME);
+    expected_usr = getpwnam (MBIM_USERNAME);
     if (!expected_usr) {
-        g_warning ("Unknown user configured: %s", MBIM_PROXY_USERNAME);
+        g_warning ("Unknown user configured: %s", MBIM_USERNAME);
         /* Falling back to check for root user if the configured user is unknown */
         if (uid != 0) {
             g_warning ("Client not allowed: Not enough privileges");
@@ -1074,7 +1074,7 @@ incoming_cb (GSocketService *service,
         }
     }
     else if (uid != expected_usr->pw_uid) {
-        g_warning ("Client not allowed: Not the expected user: %s", MBIM_PROXY_USERNAME);
+        g_warning ("Client not allowed: Not the expected user: %s", MBIM_USERNAME);
         return;
     }
 
@@ -1229,9 +1229,9 @@ mbim_proxy_new (GError **error)
     struct passwd *expected_usr = NULL;
 
     /* Only the specified user can run the mbim-proxy */
-    expected_usr = getpwnam (MBIM_PROXY_USERNAME);
+    expected_usr = getpwnam (MBIM_USERNAME);
     if (!expected_usr) {
-        g_warning ("Unknown user configured: %s", MBIM_PROXY_USERNAME);
+        g_warning ("Unknown user configured: %s", MBIM_USERNAME);
         /* Falling back to check for root user if the configured user is unknown */
         if (getuid () != 0) {
             g_set_error (error,
@@ -1245,7 +1245,7 @@ mbim_proxy_new (GError **error)
         g_set_error (error,
                      MBIM_CORE_ERROR,
                      MBIM_CORE_ERROR_FAILED,
-                     "Not started with the expected user: %s", MBIM_PROXY_USERNAME);
+                     "Not started with the expected user: %s", MBIM_USERNAME);
         return NULL;
     }
 
-- 
2.1.0.rc2.206.gedb03e5



More information about the libmbim-devel mailing list