Skip to content
Snippets Groups Projects
Commit 9ba262bd authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

what a buggit add src/extra-tools/execl-subuidgid.c doc/execl-subuidgid.html

parent f141651e
No related branches found
No related tags found
No related merge requests found
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<title>The 66 Suite: execl-subuidgid</title>
<meta name="Description" content="Detailed documentation for the execl-cmdline command which is part of the 66 software suite" />
<meta name="Keywords" content="66 command execl-subuidgid service supervision execute script execline uid gid substitute" />
<!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
</head>
<body>
<p>
<a href="index.html">66</a><br />
<a href="//obarun.org/">www.obarun.org</a>
</p>
<h1>execl-subuidgid</h1>
<p>
This command substitute a litteral GID UID term by the UID GID of the current owner of the process.
</p>
<h2> Interface </h2>
<pre>
execl-subuidgid [ -o owner ] <em>prog</em>
</pre>
<ul>
<li>
<tt>execl-subuidgid</tt> reads the <em>command</em> and substitute the variable UID GID on <em>prog</em>.
</li>
</ul>
<h2> Options </h2>
<ul>
<li>
<tt>-o&nbsp;<em>owner</em>&nbsp;</tt>: set UID GID of <em>owner</em> instead of the current one.
</li>
</ul>
<h2> Usage examples </h2>
<p>
<pre>
execl-subuidgid
if { mkdir -p /run/user }
chown -R $UID:$GID /run/user
</pre>
<pre>
execl-subuidgid -o root
if { mkdir /run }
chmow -R $UID:$GID /run/user
</pre>
</p>
<p>
</body>
</html>
......@@ -14,7 +14,7 @@
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <oblibs/error2.h>
#include <skalibs/types.h>
......@@ -74,12 +74,15 @@ int main (int argc, char const **argv, char const *const *envp)
argc -= l.ind ; argv += l.ind ;
}
if (owner)
{
if (!youruid(&uid,owner)) strerr_diefu2sys(111,"get uid of: ",owner) ;
}
else uid = getuid() ;
if (!yourgid(&gid,uid)) strerr_diefu1sys(111,"get gid") ;
cuid[uid_fmt(cuid,uid)] = 0 ;
cgid[uid_fmt(cgid,gid)] = 0 ;
cgid[gid_fmt(cgid,gid)] = 0 ;
if (!env_addkv("UID",cuid,&info)) strerr_diefu1sys(111,"set UID") ;
if (!env_addkv("GID",cgid,&info)) strerr_diefu1sys(111,"set GID") ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment