ad_machine_pw_renewal.c revision 45e11be651dbd3855a35de4abd2922e5b9d4b963
/*
SSSD
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2016 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "util/strtonum.h"
#include "providers/dp_ptask.h"
#include "providers/ad/ad_common.h"
#ifndef RENEWAL_PROG_PATH
#define RENEWAL_PROG_PATH "/usr/sbin/adcli"
#endif
struct renewal_data {
char *prog_path;
const char **extra_args;
};
const char *ad_hostname,
const char *ad_keytab,
struct renewal_data *renewal_data)
{
const char **args;
size_t c = 0;
return EINVAL;
}
return ENOMEM;
}
return ENOMEM;
}
/* extra_args are added in revers order */
/* first add NULL as a placeholder for the server name which is determined
* at runtime */
}
if (DEBUG_IS_SET(SSSDBG_TRACE_LIBS)) {
}
do {
"talloc failed while copying arguments.\n");
return ENOMEM;
}
} while (c != 1); /* is is expected that the first element is NULL */
return EOK;
}
struct renewal_state {
int child_status;
struct sss_child_ctx_old *child_ctx;
struct tevent_timer *timeout_handler;
struct tevent_context *ev;
struct child_io_fds *io;
};
static void
struct tevent_timer *te,
static struct tevent_req *
struct tevent_context *ev,
void *pvt)
{
struct renewal_data *renewal_data;
struct renewal_state *state;
struct tevent_req *req;
struct tevent_req *subreq;
int ret;
const char **extra_args;
const char *server_name;
return NULL;
}
goto done;
}
if (server_name != NULL) {
"--domain-controller=%s",
/* if talloc_asprintf() fails we let adcli try to find a server */
}
if (extra_args[0] == NULL) {
}
if (ret == -1) {
goto done;
}
if (ret == -1) {
goto done;
}
if (child_pid == 0) { /* child */
extra_args, true,
/* We should never get here */
} else if (child_pid > 0) { /* parent */
/* Set up SIGCHLD handler */
goto done;
}
/* Set up timeout handler */
req);
goto done;
}
goto done;
}
/* Now either wait for the timeout to fire or the child
* to finish
*/
} else { /* error */
goto done;
}
done:
}
return req;
}
{
struct tevent_req);
int ret;
return;
}
"%.*s"
"---adcli output end---\n",
return;
}
static void
struct tevent_timer *te,
{
}
static errno_t
{
return EOK;
}
struct ad_options *ad_opts)
{
int ret;
struct renewal_data *renewal_data;
int lifetime;
const char *dummy;
char **opt_list;
int opt_list_size;
char *endptr;
if (ret != 0) {
return EOK;
}
if (lifetime == 0) {
return EOK;
}
if (lifetime < 0) {
"Illegal value [%d] for password lifetime.\n", lifetime);
return EINVAL;
}
if (renewal_data == NULL) {
return ENOMEM;
}
&opt_list, &opt_list_size);
goto done;
}
if (opt_list_size != 2) {
goto done;
}
errno = 0;
goto done;
}
errno = 0;
goto done;
}
goto done;
}
"AD machine account password renewal", NULL);
goto done;
}
done:
}
return ret;
}