Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nslcd.h
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2009-04-19 15:51:47 +0200
committerArthur de Jong <arthur@arthurdejong.org>2009-04-19 15:51:47 +0200
commit63a3783c05732d89c4faa1f4519d7e83f26e2a5a (patch)
treec67eb29fdae08d53a98b664dbb98b748685022c9 /nslcd.h
parent57b29d91d65182378507e9d5362a1618ee235e38 (diff)
clear up protocol description in nslcd.h, renaming NSLCD_RESULT_SUCCESS to NSLCD_RESULT_BEGIN
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@834 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd.h')
-rw-r--r--nslcd.h219
1 files changed, 102 insertions, 117 deletions
diff --git a/nslcd.h b/nslcd.h
index bc2c2d4..854a1e6 100644
--- a/nslcd.h
+++ b/nslcd.h
@@ -2,7 +2,7 @@
nslcd.h - file describing client/server protocol
Copyright (C) 2006 West Consulting
- Copyright (C) 2006, 2007 Arthur de Jong
+ Copyright (C) 2006, 2007, 2009 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -30,24 +30,25 @@
mangled or not understood messages will be silently ignored by the server.
A request looks like:
- int32 NSLCD_VERSION
- int32 NSLCD_ACTION_*
+ INT32 NSLCD_VERSION
+ INT32 NSLCD_ACTION_*
[request parameters if any]
A response looks like:
- int32 NSLCD_VERSION
- int32 NSLCD_ACTION_* (the original request type)
+ INT32 NSLCD_VERSION
+ INT32 NSLCD_ACTION_* (the original request type)
[result(s)]
- NSLCD_RESULT_END
- A result looks like:
- int32 NSLCD_RESULT_SUCCESS
+ INT32 NSLCD_RESULT_END
+ A single result entry looks like:
+ INT32 NSLCD_RESULT_BEGIN
[result value(s)]
If a response would return multiple values (e.g. for NSLCD_ACTION_*_ALL
- functions) each return value will be preceded by a NSLCD_RESULT_SUCCESS
+ functions) each return value will be preceded by a NSLCD_RESULT_BEGIN
value. After the last returned result the server sends
- NSLCD_RESULT_END. If some error occurs the server terminates the
- connection to signal an error condition (breaking the protocol).
+ NSLCD_RESULT_END. If some error occurs (e.g. LDAP server unavailable,
+ error in the request, etc) the server terminates the connection to signal
+ an error condition (breaking the protocol).
- These are the available data types:
+ These are the available basic data types:
INT32 - 32-bit integer value
TYPE - a typed field that is transferred using sizeof()
STRING - a string length (32bit) followed by the string value (not
@@ -55,147 +56,131 @@
STRINGLIST - a 32-bit number noting the number of strings followed by
the strings one at a time
- Compound datatypes (such as PASSWD) are defined below as a combination of
- the above types. They are defined as macros so they can be expanded to
- code later on.
+ Furthermore the ADDRESS compound data type is defined as:
+ INT32 type of address: e.g. AF_INET or AF_INET6
+ INT32 lenght of address
+ RAW the address itself in network byte order
+ With the ADDRESSLIST using the same construct as with STRINGLIST.
- The protocol uses host-byte order for all types (except where the normal
- value in-memory is already in network-byte order like with some
- addresses). This simple protocol makes it easy to support diffenrent NSS
- implementations.
+ The protocol uses host-byte order for all types (except in the raw
+ address above).
*/
-/* used for transferring alias information */
-#define NSLCD_ALIAS \
- NSLCD_STRING(ALIAS_NAME) \
- NSLCD_STRINGLIST(ALIAS_RCPTS)
-
-/* used for transferring mac addresses */
-#define NSLCD_ETHER \
- NSLCD_STRING(ETHER_NAME) \
- NSLCD_TYPE(ETHER_ADDR,uint8_t[6])
-
-/* used for transferring group and membership information */
-#define NSLCD_GROUP \
- NSLCD_STRING(GROUP_NAME) \
- NSLCD_STRING(GROUP_PASSWD) \
- NSLCD_TYPE(GROUP_GID,gid_t) \
- NSLCD_STRINGLIST(GROUP_MEMBERS)
-
-/* used for storing address information for the host database */
-/* Note: this marcos is not expanded to code, check manually */
-#define NSLCD_ADDRESS \
- NSLCD_INT32(ADDRESS_TYPE) /* type of address: e.g. AF_INET or AF_INET6 */ \
- NSLCD_INT32(ADDRESS_LEN) /* length of the address to follow */ \
- NSLCD_BUF(ADDRESS_ADDR) /* the address itself in network byte order */
-
-/* used for transferring host (/etc/hosts) information */
-/* Note: this marco is not expanded to code, check manually */
-#define NSLCD_HOST \
- NSLCD_STRING(HOST_NAME) \
- NSLCD_STRINGLIST(HOST_ALIASES) \
- NSLCD_ADDRESSLIST(HOST_ADDRS)
-
-/* used for transferring netgroup entries one at a time */
-/* Note: this marcos is not expanded to code, check manually */
-/* netgroup messages are split into two parts, first a part
- determining the type */
-#define NETGROUP_TYPE_NETGROUP 123
-#define NETGROUP_TYPE_TRIPLE 456
-#define NSLCD_NETGROUP_TYPE \
- NSLCD_INT32(NETGROUP_TYPE) /* one of the above values */
-/* followed by one of these message parts */
-#define NSLCD_NETGROUP_NETGROUP \
- NSLCD_STRING(NETGROUP_NETGROUP)
-#define NSLCD_NETGROUP_TRIPLE \
- NSLCD_STRING(NETGROUP_HOST) \
- NSLCD_STRING(NETGROUP_USER) \
- NSLCD_STRING(NETGROUP_DOMAIN)
-
-/* user for transferring network (/etc/networks) information */
-/* Note: this marco is not expanded to code, check manually */
-#define NSLCD_NETWORK \
- NSLCD_STRING(NETWORK_NAME) \
- NSLCD_STRINGLIST(NETWORK_ALIASES) \
- NSLCD_ADDRESSLIST(NETWORK_ADDRS)
-
-/* used for transferring user (/etc/passwd) information */
-#define NSLCD_PASSWD \
- NSLCD_STRING(PASSWD_NAME) \
- NSLCD_STRING(PASSWD_PASSWD) \
- NSLCD_TYPE(PASSWD_UID,uid_t) \
- NSLCD_TYPE(PASSWD_GID,gid_t) \
- NSLCD_STRING(PASSWD_GECOS) \
- NSLCD_STRING(PASSWD_DIR) \
- NSLCD_STRING(PASSWD_SHELL)
-
-/* used for transferring protocol information */
-#define NSLCD_PROTOCOL \
- NSLCD_STRING(PROTOCOL_NAME) \
- NSLCD_STRINGLIST(PROTOCOL_ALIASES) \
- NSLCD_INT32(PROTOCOL_NUMBER)
-
-/* for transferring struct rpcent structs */
-#define NSLCD_RPC \
- NSLCD_STRING(RPC_NAME) \
- NSLCD_STRINGLIST(RPC_ALIASES) \
- NSLCD_INT32(RPC_NUMBER)
-
-/* for transferring struct servent information */
-#define NSLCD_SERVICE \
- NSLCD_STRING(SERVICE_NAME) \
- NSLCD_STRINGLIST(SERVICE_ALIASES) \
- NSLCD_INT32(SERVICE_NUMBER) \
- NSLCD_STRING(SERVICE_PROTOCOL)
-
-/* used for transferring account (/etc/shadow) information */
-#define NSLCD_SHADOW \
- NSLCD_STRING(SHADOW_NAME) \
- NSLCD_STRING(SHADOW_PASSWD) \
- NSLCD_INT32(SHADOW_LASTCHANGE) \
- NSLCD_INT32(SHADOW_MINDAYS) \
- NSLCD_INT32(SHADOW_MAXDAYS) \
- NSLCD_INT32(SHADOW_WARN) \
- NSLCD_INT32(SHADOW_INACT) \
- NSLCD_INT32(SHADOW_EXPIRE) \
- NSLCD_INT32(SHADOW_FLAG)
-
/* The current version of the protocol. Note that version 1
is experimental and this version will be used until a
1.0 release of nss-ldapd is made. */
#define NSLCD_VERSION 1
-/* Request types. */
+/* Email alias (/etc/aliases) NSS requests. The result values for a
+ single entry are:
+ STRING alias name
+ STRINGLIST alias rcpts */
#define NSLCD_ACTION_ALIAS_BYNAME 4001
#define NSLCD_ACTION_ALIAS_ALL 4002
+
+/* Ethernet address/name mapping NSS requests. The result values for a
+ single entry are:
+ STRING ether name
+ TYPE(uint8_t[6]) ether address */
#define NSLCD_ACTION_ETHER_BYNAME 3001
#define NSLCD_ACTION_ETHER_BYETHER 3002
#define NSLCD_ACTION_ETHER_ALL 3005
+
+/* Group and group membership related NSS requests. The result values
+ for a single entry are:
+ STRING group name
+ STRING group password
+ TYPE(gid_t) group id
+ STRINGLIST members (usernames) of the group
+ (not that the BYMEMER call returns an emtpy members list) */
#define NSLCD_ACTION_GROUP_BYNAME 5001
#define NSLCD_ACTION_GROUP_BYGID 5002
#define NSLCD_ACTION_GROUP_BYMEMBER 5003
#define NSLCD_ACTION_GROUP_ALL 5004
+
+/* Hostname (/etc/hosts) lookup NSS requests. The result values
+ for an entry are:
+ STRING host name
+ STRINGLIST host aliases
+ ADDRESSLIST host addresses */
#define NSLCD_ACTION_HOST_BYNAME 6001
#define NSLCD_ACTION_HOST_BYADDR 6002
#define NSLCD_ACTION_HOST_ALL 6005
+
+/* Netgroup NSS request return a number of results. Result values
+ can be either a reference to another netgroup:
+ INT32 NETGROUP_TYPE_NETGROUP
+ STRING other netgroup name
+ or a netgroup triple:
+ INT32 NETGROUP_TYPE_TRIPLE
+ STRING host
+ STRING user
+ STRING domain */
#define NSLCD_ACTION_NETGROUP_BYNAME 12001
+#define NETGROUP_TYPE_NETGROUP 123
+#define NETGROUP_TYPE_TRIPLE 456
+
+/* Network name (/etc/networks) NSS requests. Result values for a single
+ entry are:
+ STRING network name
+ STRINGLIST network aliases
+ ADDRESSLIST network addresses */
#define NSLCD_ACTION_NETWORK_BYNAME 8001
#define NSLCD_ACTION_NETWORK_BYADDR 8002
#define NSLCD_ACTION_NETWORK_ALL 8005
+
+/* User account (/etc/passwd) NSS requests. Result values are:
+ STRING user name
+ STRING user password
+ TYPE(uid_t) user id
+ TYPE(gid_t) group id
+ STRING gecos information
+ STRING home directory
+ STRING login shell */
#define NSLCD_ACTION_PASSWD_BYNAME 1001
#define NSLCD_ACTION_PASSWD_BYUID 1002
#define NSLCD_ACTION_PASSWD_ALL 1004
+
+/* Protocol information requests. Result values are:
+ STRING protocol name
+ STRINGLIST protocol aliases
+ INT32 protocol number */
#define NSLCD_ACTION_PROTOCOL_BYNAME 9001
#define NSLCD_ACTION_PROTOCOL_BYNUMBER 9002
#define NSLCD_ACTION_PROTOCOL_ALL 9003
+
+/* RPC information requests. Result values are:
+ STRING rpc name
+ STRINGLIST rpc aliases
+ INT32 rpc number */
#define NSLCD_ACTION_RPC_BYNAME 10001
#define NSLCD_ACTION_RPC_BYNUMBER 10002
#define NSLCD_ACTION_RPC_ALL 10003
+
+/* Service (/etc/services) information requests. Result values are:
+ STRING service name
+ STRINGLIST service aliases
+ INT32 service (port) number
+ STRING service protocol */
#define NSLCD_ACTION_SERVICE_BYNAME 11001
#define NSLCD_ACTION_SERVICE_BYNUMBER 11002
#define NSLCD_ACTION_SERVICE_ALL 11005
+
+/* Extended user account (/etc/shadow) information requests. Result
+ values for a single entry are:
+ STRING user name
+ STRING user password
+ INT32 last password change
+ INT32 mindays
+ INT32 maxdays
+ INT32 warn
+ INT32 inact
+ INT32 expire
+ INT32 flag */
#define NSLCD_ACTION_SHADOW_BYNAME 2001
#define NSLCD_ACTION_SHADOW_ALL 2005
+
+/* PAM-related requests. The requests and responses need to be defined. */
#define NSLCD_ACTION_PAM_AUTHC 20001
#define NSLCD_ACTION_PAM_AUTHZ 20002
#define NSLCD_ACTION_PAM_SESS_O 20003
@@ -203,7 +188,7 @@
#define NSLCD_ACTION_PAM_PWMOD 20005
/* Request result codes. */
-#define NSLCD_RESULT_END 3 /* key was not found */
-#define NSLCD_RESULT_SUCCESS 0 /* everything ok */
+#define NSLCD_RESULT_BEGIN 0
+#define NSLCD_RESULT_END 3
#endif /* not _NSLCD_H */