[PATCH 1/2] build: rename '--enable-qmi-proxy-username' to '--enable-qmi-username'
Aleksander Morgado
aleksander at aleksander.es
Sun Nov 9 11:12:00 PST 2014
This shouldn't be a proxy-only setting. We're going to chown the QMI devices to
this specific user, so we'll re-use this setting for that as well.
---
configure.ac | 24 ++++++++++--------------
src/libqmi-glib/qmi-proxy.c | 12 ++++++------
2 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8c73ca7..754cbae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,16 +79,11 @@ AC_SUBST(GLIB_MKENUMS)
dnl Documentation
GTK_DOC_CHECK(1.0)
-# QMI proxy UID
-AC_ARG_ENABLE(qmi-proxy-username,
- AS_HELP_STRING([--enable-qmi-proxy-username=<username>], [where qmi proxy username is]),
- qmi_proxy_username=$enableval,
- qmi_proxy_username="")
-if ! test x"$qmi_proxy_username" = x""; then
- AC_DEFINE_UNQUOTED(QMI_PROXY_USERNAME, $qmi_proxy_username, [Define the QMI Proxy username])
-else
- AC_DEFINE(QMI_PROXY_USERNAME, "root", [Define the QMI Proxy username])
-fi
+# QMI username
+AC_ARG_ENABLE(qmi-username,
+ AS_HELP_STRING([--enable-qmi-username=<username>], [user allowed to access QMI devices]),,
+ enable_qmi_username="root")
+AC_DEFINE_UNQUOTED(QMI_USERNAME, "$enable_qmi_username", [Define the QMI username])
dnl Man page
AC_PATH_PROG(HELP2MAN, help2man, false)
@@ -121,8 +116,9 @@ echo "
libqmi (libqmi-glib, qmicli) $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}
+ QMI username: ${enable_qmi_username}
"
diff --git a/src/libqmi-glib/qmi-proxy.c b/src/libqmi-glib/qmi-proxy.c
index ed4210d..0ecff30 100644
--- a/src/libqmi-glib/qmi-proxy.c
+++ b/src/libqmi-glib/qmi-proxy.c
@@ -648,9 +648,9 @@ incoming_cb (GSocketService *service,
return;
}
- expected_usr = getpwnam (QMI_PROXY_USERNAME);
+ expected_usr = getpwnam (QMI_USERNAME);
if (!expected_usr) {
- g_warning ("Unknown user configured: %s", QMI_PROXY_USERNAME);
+ g_warning ("Unknown user configured: %s", QMI_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");
@@ -658,7 +658,7 @@ incoming_cb (GSocketService *service,
}
}
else if (uid != expected_usr->pw_uid) {
- g_warning ("Client not allowed: Not the expected user: %s", QMI_PROXY_USERNAME);
+ g_warning ("Client not allowed: Not the expected user: %s", QMI_USERNAME);
return;
}
@@ -747,9 +747,9 @@ qmi_proxy_new (GError **error)
struct passwd *expected_usr = NULL;
/* Only the specified user can run the mbim-proxy */
- expected_usr = getpwnam (QMI_PROXY_USERNAME);
+ expected_usr = getpwnam (QMI_USERNAME);
if (!expected_usr) {
- g_warning ("Unknown user configured: %s", QMI_PROXY_USERNAME);
+ g_warning ("Unknown user configured: %s", QMI_USERNAME);
/* Falling back to check for root user if the configured user is unknown */
if (getuid () != 0) {
g_set_error (error,
@@ -763,7 +763,7 @@ qmi_proxy_new (GError **error)
g_set_error (error,
QMI_CORE_ERROR,
QMI_CORE_ERROR_FAILED,
- "Not started with the expected user: %s", QMI_PROXY_USERNAME);
+ "Not started with the expected user: %s", QMI_USERNAME);
return NULL;
}
--
2.1.3
More information about the libqmi-devel
mailing list