| 1 | <?xml version="1.0"?> |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>auth_mkhomedir</title><link rel="stylesheet" type="text/css" href="style.css"/><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"/><link rel="home" href="#auth-getuserinfo" title="auth_mkhomedir"/><link xmlns="" rel="stylesheet" type="text/css" href="manpage.css"/><meta xmlns="" name="MSSmartTagsPreventParsing" content="TRUE"/><link xmlns="" rel="icon" href="icon.gif" type="image/gif"/><!-- |
| 3 | |
| 4 | Copyright 1998 - 2009 Double Precision, Inc. See COPYING for distribution |
| 5 | information. |
| 6 | |
| 7 | --></head><body><div class="refentry"><a id="auth-getuserinfo" shape="rect"> </a><div class="titlepage"/><div class="refnamediv"><h2>Name</h2><p>auth_mkhomedir — Autocreate a new account's home directory</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="literallayout"><p><br clear="none"/> |
| 8 | #include <courierauth.h><br clear="none"/> |
| 9 | </p></div><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td rowspan="1" colspan="1"><code class="funcdef">int rc=<strong>auth_mkhomedir</strong>(</code></td><td rowspan="1" colspan="1">struct authinfo *<var class="pdparam">auth</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a id="idm140386923679360" shape="rect"> </a><h2>DESCRIPTION</h2><p> |
| 10 | A <em class="replaceable"><code>callback_func</code></em> that's passed as a parameter |
| 11 | to |
| 12 | <a class="ulink" href="auth_getuserinfo.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">auth_getuserinfo</span>(3)</span></a> |
| 13 | can invoke this function to automatically create a new account's |
| 14 | home directory, if the authlib client is running as root, forwarding |
| 15 | the <code class="classname">authinfo</code> pointer from the callback. |
| 16 | </p><p> |
| 17 | <code class="function">auth_mkhomedir</code>() checks if the |
| 18 | <code class="envar">AUTH_MKHOMEDIR_SKEL</code> environment variable is set, and |
| 19 | if the authenticated account's home directory does not exist. |
| 20 | If the environment variable is set it must point to a directory like |
| 21 | <code class="filename">/etc/skel</code> that contains a template for the |
| 22 | contents of a new account's home directory. |
| 23 | </p><p> |
| 24 | If <code class="envar">AUTH_MKHOMEDIR_SKEL</code> is not set, or if the home |
| 25 | directory exists, |
| 26 | <code class="function">auth_mkhomedir</code>() does nothing and returns 0. |
| 27 | Otherwise the account's home directory gets created, and |
| 28 | the contents of the <code class="envar">AUTH_MKHOMEDIR_SKEL</code> |
| 29 | directory get recursively copied into the new home directory. |
| 30 | The permissions of <code class="envar">AUTH_MKHOMEDIR_SKEL</code> and its contents |
| 31 | are preserved, and the owner userid and groupid is set to the |
| 32 | authenticated account's userid and groupid. |
| 33 | </p></div><div class="refsect1"><a id="idm140386922126464" shape="rect"> </a><h2>RETURNS</h2><p> |
| 34 | <code class="function">auth_mkhomedir</code>() returns a non-zero value if |
| 35 | an error occured while creating the new account's home directory. |
| 36 | <code class="function">auth_mkhomedir</code>() returns zero if the new |
| 37 | account's home directory was created successfully, or if the |
| 38 | account's home directory already exists. |
| 39 | </p></div><div class="refsect1"><a id="idm140386924285184" shape="rect"> </a><h2>SEE ALSO</h2><p> |
| 40 | <a class="ulink" href="authlib.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">authlib</span>(3)</span></a>, |
| 41 | |
| 42 | <a class="ulink" href="auth_getuserinfo.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">auth_getuserinfo</span>(3)</span></a>.</p></div></div></body></html> |