CVE-2022-2031 s4:kdc: Reject tickets during the last two minutes of their life
[Samba.git] / lib / util / server_id.h
blob5b723d5cda40d100a36b24fa76f7d548dc0ec58d
1 /*
2 Unix SMB/CIFS implementation.
3 Samba utility functions
4 Copyright (C) Andrew Bartlett 2011
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __LIB_UTIL_SERVER_ID_H__
21 #define __LIB_UTIL_SERVER_ID_H__
23 #include "replace.h"
25 struct server_id;
27 struct server_id_buf { char buf[48]; }; /* probably a bit too large ... */
29 bool server_id_same_process(const struct server_id *p1,
30 const struct server_id *p2);
31 int server_id_cmp(const struct server_id *p1, const struct server_id *p2);
32 bool server_id_equal(const struct server_id *p1, const struct server_id *p2);
33 char *server_id_str_buf(struct server_id id, struct server_id_buf *dst);
34 size_t server_id_str_buf_unique(struct server_id id, char *buf, size_t buflen);
36 struct server_id server_id_from_string(uint32_t local_vnn,
37 const char *pid_string);
39 /**
40 * Set the serverid to the special value that represents a disconnected
41 * client for (e.g.) durable handles.
43 void server_id_set_disconnected(struct server_id *id);
45 /**
46 * check whether a serverid is the special placeholder for
47 * a disconnected client
49 bool server_id_is_disconnected(const struct server_id *id);
51 #define SERVER_ID_BUF_LENGTH 24
52 void server_id_put(uint8_t buf[SERVER_ID_BUF_LENGTH],
53 const struct server_id id);
54 void server_id_get(struct server_id *id,
55 const uint8_t buf[SERVER_ID_BUF_LENGTH]);
57 #endif