Fix size of int on 32 bits hosts

This commit is contained in:
nemunaire 2020-05-05 17:23:21 +02:00
parent 82bf82034f
commit 05b47ac614
6 changed files with 7 additions and 7 deletions

View File

@ -148,7 +148,7 @@ func apiAuthHandler(f func(*config.Options, *happydns.User, httprouter.Params, i
err: err,
status: http.StatusUnauthorized,
}.WriteResponse(w)
} else if std, err := storage.MainStore.GetUser(int(session.IdUser)); err != nil {
} else if std, err := storage.MainStore.GetUser(session.IdUser); err != nil {
APIErrorResponse{
err: err,
status: http.StatusUnauthorized,

View File

@ -40,7 +40,7 @@ type Storage interface {
Close() error
GetDomains(u *happydns.User) (happydns.Domains, error)
GetDomain(u *happydns.User, id int) (*happydns.Domain, error)
GetDomain(u *happydns.User, id int64) (*happydns.Domain, error)
GetDomainByDN(u *happydns.User, dn string) (*happydns.Domain, error)
DomainExists(dn string) bool
CreateDomain(u *happydns.User, z *happydns.Domain) error
@ -64,7 +64,7 @@ type Storage interface {
ClearSources() error
GetUsers() (happydns.Users, error)
GetUser(id int) (*happydns.User, error)
GetUser(id int64) (*happydns.User, error)
GetUserByEmail(email string) (*happydns.User, error)
UserExists(email string) bool
CreateUser(user *happydns.User) error

View File

@ -60,7 +60,7 @@ func (s *LevelDBStorage) GetDomains(u *happydns.User) (domains happydns.Domains,
return
}
func (s *LevelDBStorage) GetDomain(u *happydns.User, id int) (z *happydns.Domain, err error) {
func (s *LevelDBStorage) GetDomain(u *happydns.User, id int64) (z *happydns.Domain, err error) {
z = &happydns.Domain{}
err = s.get(fmt.Sprintf("domain-%d", id), &z)

View File

@ -56,7 +56,7 @@ func (s *LevelDBStorage) GetUsers() (users happydns.Users, err error) {
return
}
func (s *LevelDBStorage) GetUser(id int) (u *happydns.User, err error) {
func (s *LevelDBStorage) GetUser(id int64) (u *happydns.User, err error) {
u = &happydns.User{}
err = s.get(fmt.Sprintf("user-%d", id), &u)
return

View File

@ -56,7 +56,7 @@ func (s *MySQLStorage) GetDomains(u *happydns.User) (domains happydns.Domains, e
}
}
func (s *MySQLStorage) GetDomain(u *happydns.User, id int) (z *happydns.Domain, err error) {
func (s *MySQLStorage) GetDomain(u *happydns.User, id int64) (z *happydns.Domain, err error) {
z = &happydns.Domain{}
err = s.db.QueryRow("SELECT id_domain, id_user, id_source, domain FROM domains WHERE id_domain=? AND id_user=?", id, u.Id).Scan(&z.Id, &z.IdUser, &z.IdSource, &z.DomainName)
return

View File

@ -56,7 +56,7 @@ func (s *MySQLStorage) GetUsers() (users happydns.Users, err error) {
}
}
func (s *MySQLStorage) GetUser(id int) (u *happydns.User, err error) {
func (s *MySQLStorage) GetUser(id int64) (u *happydns.User, err error) {
u = &happydns.User{}
err = s.db.QueryRow("SELECT id_user, email, password, salt, registration_time FROM users WHERE id_user=?", id).Scan(&u.Id, &u.Email, &u.Password, &u.Salt, &u.RegistrationTime)
return