示例#1
0
文件: acl.go 项目: naegelejd/go-acl
// Parse constructs and ACL from a string representation.
func Parse(s string) (*ACL, error) {
	cs := C.CString(s)
	cacl, _ := C.acl_from_text(cs)
	if cacl == nil {
		return nil, fmt.Errorf("unable to parse ACL")
	}
	return &ACL{cacl}, nil
}
示例#2
0
文件: acl.go 项目: postfix/go-acl
func NewFromString(s string) (self *ACL, e error) {
	cs := C.CString(s)
	ptr, err := C.acl_from_text(cs)
	if err != nil {
		return nil, err
	}
	ret, err := C.acl_valid(ptr)
	if ret != 0 && err != nil {
		return nil, err
	}
	self = &ACL{ptr: ptr}
	return self, nil
}