dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / libads / common / poke.c
blob3c3b45d24ffe26121636fa629e06b639e1b003ed
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
17 * Private API to force DC Rediscovery.
20 #include <stdlib.h>
21 #include <string.h>
22 #include <smb/nterror.h>
23 #include <arpa/inet.h>
24 #include "dsgetdc.h"
25 #include "ads_priv.h"
26 #include <assert.h>
28 static struct timeval TIMEOUT = { 15, 0 };
30 int
31 _DsForceRediscovery(char *domain, int flags)
33 DsForceRediscoveryArgs args;
34 CLIENT *clnt = NULL;
35 enum clnt_stat clstat;
36 int res;
38 (void) memset(&args, 0, sizeof (args));
39 args.Flags = flags;
40 args.DomainName = domain;
43 * Call the ADS deamon.
45 clnt = clnt_door_create(ADSPRIV_PROGRAM, ADSPRIV_V1, ADSPRIV_MAX_XFER);
46 if (clnt == NULL)
47 return (RPC_S_NOT_LISTENING);
49 clstat = clnt_call(clnt, ADSPRIV_ForceRediscovery,
50 (xdrproc_t)xdr_DsForceRediscoveryArgs, (caddr_t)&args,
51 (xdrproc_t)xdr_int, (caddr_t)&res, TIMEOUT);
53 clnt_destroy(clnt);
54 if (clstat != RPC_SUCCESS)
55 return (RPC_S_CALL_FAILED);
57 return (res);