149 |
# this wrapper runs a command in the xsession of the unpriv_user |
# this wrapper runs a command in the xsession of the unpriv_user |
150 |
x11runas() |
x11runas() |
151 |
{ |
{ |
152 |
if [[ -n $(pidof X) ]] || [[ -n $(pidof Xorg) ]] |
if [[ -n $(pidof X) ]] || [[ -n $(pidof Xorg) ]] || [[ -n $(pidof Xorg.bin) ]] |
153 |
then |
then |
154 |
su - "${MCORE_UNPRIV_USER}" -c "DISPLAY=${MCORE_XORG_DISPLAY} $@" |
su - "${MCORE_UNPRIV_USER}" -c "DISPLAY=${MCORE_XORG_DISPLAY} $@" |
155 |
|
else |
156 |
|
decho "x11runas(): No running X, Xorg or Xorg.bin process found" |
157 |
fi |
fi |
158 |
} |
} |
159 |
|
|
370 |
quit |
quit |
371 |
EOF |
EOF |
372 |
} |
} |
373 |
|
|
374 |
|
nsslsay_queue_init() |
375 |
|
{ |
376 |
|
SSLSAY_QUEUE=() |
377 |
|
} |
378 |
|
|
379 |
|
nsslsay_queue_add() |
380 |
|
{ |
381 |
|
SSLSAY_QUEUE+=( "$@" ) |
382 |
|
} |
383 |
|
|
384 |
|
nsslsay_queue_print() |
385 |
|
{ |
386 |
|
local count |
387 |
|
local i |
388 |
|
|
389 |
|
count="${#SSLSAY_QUEUE[*]}" |
390 |
|
for ((i=0; i < count; i++)) |
391 |
|
do |
392 |
|
echo "${SSLSAY_QUEUE[${i}]}" |
393 |
|
done |
394 |
|
} |
395 |
|
|
396 |
|
nsslsay_queue_run() |
397 |
|
{ |
398 |
|
nsslsay "$(nsslsay_queue_print)" |
399 |
|
} |
400 |
|
|
401 |
|
nsslsay_queue_run_fingerprint() |
402 |
|
{ |
403 |
|
nsslsay_fingerprint "$(nsslsay_queue_print)" |
404 |
|
} |
405 |
|
|
406 |
|
# read_cmdline "$variable" |
407 |
|
# eg: read_cmdline "lang=" |
408 |
|
# returns the value of the cmdline variable lang |
409 |
|
# eg: read_cmdline "rd.info" |
410 |
|
# returns bool 1 if the variable was defined |
411 |
|
# |
412 |
|
read_cmdline() |
413 |
|
{ |
414 |
|
local variable="$1" |
415 |
|
local retval |
416 |
|
local i |
417 |
|
|
418 |
|
if [[ -z ${variable} ]] |
419 |
|
then |
420 |
|
eecho "no variable given" |
421 |
|
return 1 |
422 |
|
fi |
423 |
|
|
424 |
|
if [ ! -e /proc/cmdline ] |
425 |
|
then |
426 |
|
eecho "read_cmdline(): /proc/cmdline does not exists" |
427 |
|
return 1 |
428 |
|
fi |
429 |
|
|
430 |
|
for i in $(</proc/cmdline) |
431 |
|
do |
432 |
|
if [[ ${i} = ${variable}* ]] |
433 |
|
then |
434 |
|
case ${variable} in |
435 |
|
*=*) retval="${i#*=}" ;; |
436 |
|
*) retval=1 ;; # bool |
437 |
|
esac |
438 |
|
fi |
439 |
|
done |
440 |
|
|
441 |
|
echo "${retval}" |
442 |
|
return 0 |
443 |
|
} |