summaryrefslogtreecommitdiff
path: root/server/responder/common/responder_cmd.h
blob: b70b297a5b4718b432ad41e8af8dedd3e2792fdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
   SSSD

   SSS Client Responder, header file

   Copyright (C) Simo Sorce <ssorce@redhat.com>	2008

   This program is free software; you can redistribute it and/or modify
   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/>.
*/

#ifndef __SSSSRV_CMD_H__
#define __SSSSRV_CMD_H__

#include <stdint.h>
#include <sys/un.h>
#include "talloc.h"
#include "tevent.h"
#include "ldb.h"
#include "../sss_client/sss_cli.h"

/* needed until nsssrv.h is updated */
#ifndef __NSSSRV_H__
struct cli_request {

    /* original request from the wire */
    struct sss_packet *in;

    /* reply data */
    struct sss_packet *out;
};

struct nss_ctx {
    struct tevent_context *ev;
    struct tevent_fd *lfde;
    int lfd;
    struct tevent_fd *priv_lfde;
    int priv_lfd;
    struct sysdb_ctx *sysdb;
    struct confdb_ctx *cdb;
    const char *sock_name;
    const char *priv_sock_name;
    struct service_sbus_ctx *ss_ctx;
    struct service_sbus_ctx *dp_ctx;
    struct btreemap *domain_map;
    char *default_domain;

    int cache_timeout;

    struct sbus_method *sss_sbus_methods;
    struct sss_cmd_table *sss_cmds;
    const char *sss_pipe_name;
    const char *confdb_socket_path;
    struct sbus_method *dp_methods;
};


struct cli_ctx {
    struct tevent_context *ev;
    struct nss_ctx *nctx;
    int cfd;
    struct tevent_fd *cfde;
    struct sockaddr_un addr;
    struct cli_request *creq;
    struct getent_ctx *gctx;
    int priv;
};
#endif

struct sss_cmd_ctx {
    struct cli_ctx *cctx;
    const char *domain;
    const char *name;
    uid_t id;
    bool check_expiration;
};

struct sss_cmd_table {
    enum sss_cli_command cmd;
    int (*fn)(struct cli_ctx *cctx);
};

int sss_cmd_execute(struct cli_ctx *cctx, struct sss_cmd_table *sss_cmds);
void sss_cmd_done(struct sss_cmd_ctx *nctx);
int sss_cmd_get_version(struct cli_ctx *cctx);

#endif /* __SSSSRV_CMD_H__ */