chiark / gitweb /
Programs invoke themselves via `userv' if necessary.
[distorted-keys] / keyfunc.sh.in
index b55bd99d0c766e7908304fca2a79f964233358de..6316816d075644f3f37fb9cb9c6e261705d6ae3e 100644 (file)
@@ -129,6 +129,17 @@ parse_keylabel () {
   knub=$KEYS/nub/$kowner/$klabel
 }
 
+runas () {
+  user=$1 service=$2; shift 2
+  ## If the current (effective) user is not USER then reinvoke via `userv',
+  ## as the specified service, with the remaining arguments.
+
+  case $(id -un) in
+    "$user") ;;
+    *) exec userv "$user" "$service" "$@" ;;
+  esac
+}
+
 ###--------------------------------------------------------------------------
 ### Input validation functions.