[wemux/f22] Checkout from git to add a small new function

Christopher Meng cicku at fedoraproject.org
Tue Feb 24 12:35:58 UTC 2015


commit aa27951888991cfd79e5f1c88c0c37b62d2317ad
Author: Christopher Meng <i at cicku.me>
Date:   Tue Feb 24 20:35:33 2015 +0800

    Checkout from git to add a small new function

 ...ty-to-specify-groups-of-users-who-are-hos.patch | 70 ++++++++++++++++++++++
 ...odified-user-group-detection-to-use-regex.patch | 26 ++++++++
 wemux.spec                                         | 15 ++++-
 3 files changed, 108 insertions(+), 3 deletions(-)
---
diff --git a/0001-Added-ability-to-specify-groups-of-users-who-are-hos.patch b/0001-Added-ability-to-specify-groups-of-users-who-are-hos.patch
new file mode 100644
index 0000000..0777143
--- /dev/null
+++ b/0001-Added-ability-to-specify-groups-of-users-who-are-hos.patch
@@ -0,0 +1,70 @@
+From c3e4b164f1ede05f54ce47f1257f828f91492ec5 Mon Sep 17 00:00:00 2001
+From: Fotios Lindiakos <flindiakos at shutterstock.com>
+Date: Tue, 14 Oct 2014 11:06:40 -0400
+Subject: [PATCH 1/2] Added ability to specify groups of users who are hosts
+
+---
+ wemux              | 16 ++++++++++++++++
+ wemux.conf.example |  4 +++-
+ 2 files changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/wemux b/wemux
+index 9aaa46f..1026e6d 100755
+--- a/wemux
++++ b/wemux
+@@ -48,6 +48,7 @@ version="3.2.0"
+ # Setup and Configuration Files.
+ # Default settings, modify them in the /usr/local/etc/wemux.conf file:
+ host_list=(change_this_in_wemux_conf)
++host_groups=()
+ socket_prefix="/tmp/wemux"
+ options="-u"
+ allow_pair_mode="true"
+@@ -681,14 +682,29 @@ client_mode() {
+   fi
+ }
+ 
++# Determine the groups the user belongs to
++groups_for_user() {
++  echo $(groups $username | awk -F: "{print \$NF}");
++}
++
+ # Check if current user is listed in the host_list.
+ user_is_a_host() {
+   for user in "${host_list[@]}"; do
+     [[ "$user" == "$username" ]] && return 0
+   done
++
++  # If the user is not in the host list, check their groups
++  user_groups="$(groups_for_user)";
++  for group in ${host_groups[@]}; do
++    if [[ $user_groups =~ " $group " ]]; then
++      return 0
++    fi
++  done
++
+   return 1
+ }
+ 
++
+ allowed_nested_command() {
+   commands=(togglemirrored setmirrored summon summon_all send users u list l display_users
+   status_users list-clients kill-sesssion kick version v)
+diff --git a/wemux.conf.example b/wemux.conf.example
+index bbc80c9..981495d 100644
+--- a/wemux.conf.example
++++ b/wemux.conf.example
+@@ -10,7 +10,9 @@
+ ## them to create wemux servers for other users to attach to.
+ ## Add the usernames of users who should use wemux in host mode:
+ ## example: host_list=(zolrath csagan brocksamson)
+-host_list=(change_this)
++
++## All users in any of the groups in host_groups will also use wemux in host mode.
++## example: host_groups=(wheel wemux)
+ 
+ ####### CLIENT OPTIONS #######
+ 
+-- 
+2.3.0
+
diff --git a/0002-Modified-user-group-detection-to-use-regex.patch b/0002-Modified-user-group-detection-to-use-regex.patch
new file mode 100644
index 0000000..59436e5
--- /dev/null
+++ b/0002-Modified-user-group-detection-to-use-regex.patch
@@ -0,0 +1,26 @@
+From d65a11e44b0c5947a8f534a212a313fac6f2eec9 Mon Sep 17 00:00:00 2001
+From: Fotios Lindiakos <flindiakos at shutterstock.com>
+Date: Fri, 14 Nov 2014 13:01:20 -0500
+Subject: [PATCH 2/2] Modified user group detection to use regex
+
+---
+ wemux | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/wemux b/wemux
+index 1026e6d..8df07d1 100755
+--- a/wemux
++++ b/wemux
+@@ -696,7 +696,8 @@ user_is_a_host() {
+   # If the user is not in the host list, check their groups
+   user_groups="$(groups_for_user)";
+   for group in ${host_groups[@]}; do
+-    if [[ $user_groups =~ " $group " ]]; then
++    group_re="\\b${group}\\b"
++    if [[ $user_groups =~ $group_re ]]; then
+       return 0
+     fi
+   done
+-- 
+2.3.0
+
diff --git a/wemux.spec b/wemux.spec
index 2f40d3a..e030b86 100644
--- a/wemux.spec
+++ b/wemux.spec
@@ -1,15 +1,17 @@
 Name:           wemux
 Version:        3.2.0
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Multi-user terminal multiplexing utility
 License:        MIT
 URL:            https://github.com/zolrath/wemux
 Source0:        https://github.com/zolrath/wemux/archive/v%{version}.tar.gz
+Patch0:         0001-Added-ability-to-specify-groups-of-users-who-are-hos.patch
+Patch1:         0002-Modified-user-group-detection-to-use-regex.patch
 BuildArch:      noarch
 Requires:       tmux
 
 %description
-wemux enhances tmux to make multi-user terminal multiplexing both easier and
+Wemux enhances tmux to make multi-user terminal multiplexing both easier and
 more powerful. It allows users to host a wemux server and have clients join
 in either:
 
@@ -27,6 +29,9 @@ and notifications when users attach/detach.
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
+# Drop undue paths, don't use env to detect bash.
 sed -i 's|/usr/local||g;s|#!/usr/bin/env bash|#!/bin/bash|g' wemux
 
 %build
@@ -37,11 +42,15 @@ install -pDm755 %{name} %{buildroot}%{_bindir}/%{name}
 install -pDm644 %{name}.conf.example %{buildroot}%{_sysconfdir}/%{name}.conf
 
 %files
-%doc MIT-LICENSE README.md
+%doc README.md
+%license MIT-LICENSE
 %{_bindir}/%{name}
 %config(noreplace) %{_sysconfdir}/%{name}.conf
 
 %changelog
+* Mon Jan 26 2015 Christopher Meng <rpm at cicku.me> - 3.2.0-3
+- Added ability to specify groups of users who are hosts.
+
 * Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.2.0-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list