func (c *SQLiteConn) authUserChange(username, password string, admin int) int {
	cuser := C.CString(username)
	cpass := C.CString(password)
	defer func() {
		C.free(unsafe.Pointer(cuser))
		C.free(unsafe.Pointer(cpass))
	}()
	return int(C._sqlite3_user_change(c.db, cuser, cpass, C.int(len(password)), C.int(admin)))
}
authUserChange allows to modify a user.
Users can change their own password.

Only admins can change passwords for other users
and modify the admin flag.

The admin flag of the current logged in user cannot be changed.
THis ensures that their is always an admin.

This is not exported for usage in Go.
It is however exported for usage within SQL by the user.

Returns:
C.SQLITE_OK (0)
C.SQLITE_ERROR (1)
C.SQLITE_AUTH (23)
package sqlite3
import "C"
import (
	"errors"
	"unsafe"
)
const (
	SQLITE_AUTH = C.SQLITE_AUTH
)
var (
	ErrUnauthorized  = errors.New("SQLITE_AUTH: Unauthorized")
	ErrAdminRequired = errors.New("SQLITE_AUTH: Unauthorized; Admin Privileges Required")
)
func (c *SQLiteConn) Authenticate(username, password string) error {
	rv := c.authenticate(username, password)
	switch rv {
	case C.SQLITE_ERROR, C.SQLITE_AUTH:
		return ErrUnauthorized
	case C.SQLITE_OK:
		return nil
	default:
		return c.lastError()
	}
}
func (c *SQLiteConn) authenticate(username, password string) int {
	cuser := C.CString(username)
	cpass := C.CString(password)
	defer func() {
		C.free(unsafe.Pointer(cuser))
		C.free(unsafe.Pointer(cpass))
	}()
	return int(C._sqlite3_user_authenticate(c.db, cuser, cpass, C.int(len(password))))
}
func (c *SQLiteConn) AuthUserAdd(username, password string, admin bool) error {
	isAdmin := 0
	if admin {
		isAdmin = 1
	}
	rv := c.authUserAdd(username, password, isAdmin)
	switch rv {
	case C.SQLITE_ERROR, C.SQLITE_AUTH:
		return ErrAdminRequired
	case C.SQLITE_OK:
		return nil
	default:
		return c.lastError()
	}
}
func (c *SQLiteConn) authUserAdd(username, password string, admin int) int {
	cuser := C.CString(username)
	cpass := C.CString(password)
	defer func() {
		C.free(unsafe.Pointer(cuser))
		C.free(unsafe.Pointer(cpass))
	}()
	return int(C._sqlite3_user_add(c.db, cuser, cpass, C.int(len(password)), C.int(admin)))
}
func (c *SQLiteConn) AuthUserChange(username, password string, admin bool) error {
	isAdmin := 0
	if admin {
		isAdmin = 1
	}
	rv := c.authUserChange(username, password, isAdmin)
	switch rv {
	case C.SQLITE_ERROR, C.SQLITE_AUTH:
		return ErrAdminRequired
	case C.SQLITE_OK:
		return nil
	default:
		return c.lastError()
	}
}