summaryrefslogtreecommitdiff
path: root/src/nslcd-proto/structures.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/nslcd-proto/structures.go')
-rw-r--r--src/nslcd-proto/structures.go249
1 files changed, 249 insertions, 0 deletions
diff --git a/src/nslcd-proto/structures.go b/src/nslcd-proto/structures.go
new file mode 100644
index 0000000..7d36940
--- /dev/null
+++ b/src/nslcd-proto/structures.go
@@ -0,0 +1,249 @@
+
+package nslcd_proto
+
+import (
+ "io"
+ "fmt"
+ "net"
+)
+
+//#include "nslcd.h"
+import "C"
+
+type Config struct {
+ Value string
+}
+type Request_Config struct { Key int32 }
+
+type Alias struct {
+ Name string
+ Recipients []string
+}
+type Request_Alias_ByName struct { Name string }
+type Request_Alias_All struct {}
+
+type Ether struct {
+ Name string
+ Address [6]byte
+}
+type Request_Ether_ByName struct { Name string }
+type Request_Ether_ByEther struct { Address [6]byte }
+type Request_Ether_All struct {}
+
+type Group struct {
+ Name string
+ Password string
+ ID int32
+ Members []string
+}
+type Request_Group_ByName struct { Name string }
+type Request_Group_ByGid struct { GID int32 }
+type Request_Group_ByMember struct { Member string }
+type Request_Group_All struct {}
+
+type Host struct {
+ Name string
+ Aliases []string
+ Addresses []net.IP
+}
+type Request_Host_ByName struct { Name string }
+type Request_Host_ByAddr struct { Address net.IP }
+type Request_Host_All struct {}
+
+type Netgroup_Netgroup struct {
+ Name string
+}
+type Netgroup_Triple struct {
+ Host string
+ User string
+ Domain string
+}
+type Netgroup_PartList []interface{}
+func (data Netgroup_PartList) NslcdWrite(fd io.Writer) {
+ for _, part := range data {
+ var t int32 = -1
+ switch part.(type) {
+ case Netgroup_Netgroup: t = C.NSLCD_NETGROUP_TYPE_NETGROUP
+ case Netgroup_Triple: t = C.NSLCD_NETGROUP_TYPE_TRIPLE
+ }
+ if t < 0 {
+ panic("invalid netgroup type")
+ }
+ write(fd, t)
+ write(fd, part)
+ }
+ write(fd, int32(C.NSLCD_NETGROUP_TYPE_END))
+}
+func (data *Netgroup_PartList) NslcdRead(fd io.Reader) {
+ *data = make([]interface{}, 0)
+ for {
+ var t int32
+ var v interface{}
+ read(fd, &t)
+ switch t {
+ case C.NSLCD_NETGROUP_TYPE_NETGROUP:
+ v = Netgroup_Netgroup{}
+ case C.NSLCD_NETGROUP_TYPE_TRIPLE:
+ v = Netgroup_Triple{}
+ case C.NSLCD_NETGROUP_TYPE_END:
+ return
+ default:
+ panic(NslcdError(fmt.Sprintf("unrecognized netgroup type: %d", t)))
+ }
+ read(fd, &v)
+ *data = append(*data, v)
+ }
+}
+var _ NslcdObject = Netgroup_PartList{}
+var _ NslcdObjectPtr = &Netgroup_PartList{}
+type Netgroup struct {
+ Name string
+ Parts Netgroup_PartList
+}
+type Request_Netgroup_ByName struct { Name string }
+type Request_Netgroup_All struct {}
+
+type Network struct {
+ Name string
+ Aliases []string
+ Addresses []net.IP
+}
+type Request_Network_ByName struct { Name string }
+type Request_Network_ByAddr struct { Address net.IP }
+type Request_Network_All struct {}
+
+type Passwd struct {
+ Name string
+ Password string
+ UID int32
+ GID int32
+ GECOS string
+ HomeDir string
+ Shell string
+}
+type Request_Passwd_ByName struct { Name string }
+type Request_Passwd_ByUID struct { UID int32 }
+type Request_Passwd_All struct {}
+
+type Protocol struct {
+ Name string
+ Aliases []string
+ Number int32
+}
+type Request_Protocol_ByName struct { Name string }
+type Request_Protocol_ByNumber struct { Number int32 }
+type Request_Protocol_All struct {}
+
+type RPC struct {
+ Name string
+ Aliases []string
+ Number int32
+}
+type Request_RPC_ByName struct { Name string }
+type Request_RPC_ByNumber struct { Number int32 }
+type Request_RPC_All struct {}
+
+type Service struct {
+ Name string
+ Aliases []string
+ PortNumber int32
+ Protocol string
+}
+type Request_Service_ByName struct { Name string }
+type Request_Service_ByNumber struct { Number int32 }
+type Request_Service_All struct {}
+
+type Shadow struct {
+ Name string
+ Password string
+ LastChangeDate int32
+ MinDays int32
+ MaxDays int32
+ WarnDays int32
+ InactDays int32
+ ExpireDate int32
+ Flag int32
+}
+type Request_Shadow_ByName struct { Name string }
+type Request_Shadow_All struct {}
+
+type PAM_Base struct {
+ UserName string
+ ServiceName string
+ RUser string
+ RHost string
+ TTY string
+}
+
+type Request_PAM_Authentication struct {
+ Base PAM_Base
+ Password string
+}
+type PAM_Authentication struct {
+ AuthenticationResult int32
+ UserName string
+ AuthorizationResult int32
+ AuthorizationError string
+}
+
+type PAM_Authorization struct {
+ Result int32
+ Error string
+}
+type Request_PAM_Authorization struct {}
+
+type PAM_SessionOpen struct {
+ SessionID string
+}
+type Request_PAM_SessionOpen struct {}
+
+type PAM_SessionClose struct {}
+type Request_PAM_SessionClose struct {
+ SessionID string
+}
+
+type Request_PAM_PwMod struct {
+ AsRoot int32
+ OldPassword string
+ NewPassword string
+}
+type PAM_PwMod struct {
+ Result int32
+ Error string
+}
+
+type UserMod_Item struct {
+ Key int32
+ Value string
+}
+type UserMod_ItemList []UserMod_Item
+func (data UserMod_ItemList) NslcdWrite(fd io.Writer) {
+ for _, item := range data {
+ write(fd, item)
+ }
+ write(fd, int32(C.NSLCD_USERMOD_END))
+}
+func (data *UserMod_ItemList) NslcdRead(fd io.Reader) {
+ *data = make([]UserMod_Item, 0)
+ for {
+ var t int32
+ read(fd, &t)
+ if t == C.NSLCD_USERMOD_END {
+ return
+ }
+ var v UserMod_Item
+ read(fd, &v)
+ *data = append(*data, v)
+ }
+}
+var _ NslcdObject = UserMod_ItemList{}
+var _ NslcdObjectPtr = &UserMod_ItemList{}
+type Request_UserMod struct {
+ UserName string
+ AsRoot int32
+ Password string
+ Items UserMod_ItemList
+}
+type UserMod struct {
+ Items []UserMod_Item
+}