コード例 #1
0
ファイル: pam.go プロジェクト: wakwanza/golang-pam
// Sets a PAM informational item.  Legal values of itemType are listed here (excluding Linux extensions):
//
// http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_set_item
//
// the CONV item type is also not supported in order to simplify the Go API (and due to
// the fact that it is completely unnecessary).
func (t *Transaction) SetItem(itemType int, item string) int {
	if itemType == CONV {
		return BAD_ITEM
	}
	cs := unsafe.Pointer(C.CString(item))
	defer C.free(cs)
	return int(C.pam_set_item(t.handle, C.int(itemType), cs))
}
コード例 #2
0
ファイル: transaction.go プロジェクト: andreynering/gogs
// SetItem sets a PAM information item.
func (t *Transaction) SetItem(i Item, item string) error {
	cs := unsafe.Pointer(C.CString(item))
	defer C.free(cs)
	t.status = C.pam_set_item(t.handle, C.int(i), cs)
	if t.status != C.PAM_SUCCESS {
		return t
	}
	return nil
}