Ejemplo n.º 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))
}
Ejemplo n.º 2
0
// 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))
}