summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2014-11-09 19:40:25 +0100
committerAleksander Morgado <aleksander@aleksander.es>2014-11-18 17:03:01 +0100
commit5f49dfb6eda7d875b28029aa901b33e34c6542a2 (patch)
tree42c3b24f357e26eea31c17611cb952e771676863
parentc474d34db0dd409818b008798df35a212447d0b9 (diff)
build: rename '--enable-qmi-proxy-username' to '--enable-qmi-username'
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.
-rw-r--r--configure.ac24
-rw-r--r--src/libqmi-glib/qmi-proxy.c12
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 d446e8f..470ea90 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;
}