예제 #1
0
// GetEnv is used to retrieve a PAM environment variable.
func (t *Transaction) GetEnv(name string) string {
	cs := C.CString(name)
	defer C.free(unsafe.Pointer(cs))
	value := C.pam_getenv(t.handle, cs)
	if value == nil {
		return ""
	}
	return C.GoString(value)
}
예제 #2
0
파일: pam.go 프로젝트: wakwanza/golang-pam
// pam_getenv.  Returns an additional argument indicating
// the actual existence of the given environment variable.
func (t *Transaction) GetEnv(name string) (string, bool) {
	cs := C.CString(name)
	defer C.free(unsafe.Pointer(cs))
	value := C.pam_getenv(t.handle, cs)
	if value != nil {
		return C.GoString(value), true
	}
	return "", false
}