예제 #1
0
// Sets a password for the specified service and username.
func (k *GnomeKeyring) Set(service, username, password string) error {
	s := C.CString(service)
	u := C.CString(username)
	p := C.CString(password)

	defer func() {
		C.free(unsafe.Pointer(s))
		C.free(unsafe.Pointer(u))
		C.free(unsafe.Pointer(p))
	}()
	return k.convertResultToErr(C.gnome_keyring_set(s, u, p))
}
예제 #2
0
파일: keyring_linux.go 프로젝트: rtrox/keys
// Sets a password for the specified service and username.
func (k *GnomeKeyring) Set(service, username, password string) error {
	s := C.CString(service)
	d := C.CString(fmt.Sprintf("Password for '%s' on '%s'", username, service))
	u := C.CString(username)
	p := C.CString(password)
	defer func() {
		C.free(unsafe.Pointer(s))
		C.free(unsafe.Pointer(d))
		C.free(unsafe.Pointer(u))
		C.free(unsafe.Pointer(p))
	}()
	return k.convertResultToErr(C.gnome_keyring_set(s, d, u, p))
}