Work on setuid/setgid, add raw-data-parser for the brmbar disaster.
This commit is contained in:
parent
ae5b9e2775
commit
8bd46721aa
4 changed files with 93 additions and 6 deletions
|
@ -36,7 +36,8 @@
|
|||
(chicken format)
|
||||
bar-db
|
||||
json
|
||||
(chicken port))
|
||||
(chicken port)
|
||||
(chicken base))
|
||||
|
||||
(define-syntax try-match-lambda1
|
||||
(syntax-rules ()
|
||||
|
@ -82,7 +83,7 @@
|
|||
(json-write
|
||||
(list->vector alst)))))
|
||||
|
||||
(define-try-match (account-barcode-info "barcode" (barcode string->number))
|
||||
(define-try-match (account-barcode-info "barcode" (barcode identity))
|
||||
(send-response
|
||||
#:body (alist->json-string
|
||||
`((amount . ,(bd-barcode-lookup barcode))))))
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
(row-values
|
||||
(query
|
||||
(bd-conn)
|
||||
"select sum(amount*case side when 'credit' then -1 else 1 end) amt from transaction_splits where account=$1"
|
||||
"select sum(amount*case side when 'credit' then -1 else 1 end) amt from transaction_splits where account=(select account from barcodes where barcode=$1)"
|
||||
bc)))))
|
||||
|
||||
)
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
uri-common
|
||||
(chicken string)
|
||||
api-servlets
|
||||
bar-db)
|
||||
bar-db
|
||||
(chicken process-context posix))
|
||||
|
||||
(define -port- (make-parameter #f))
|
||||
(define -certificate- (make-parameter #f))
|
||||
|
@ -98,8 +99,12 @@
|
|||
private-key: (-key-))
|
||||
(tcp-listen port)))
|
||||
|
||||
(when (and (-user-) (-group-))
|
||||
(switch-user/group (-user-) (-group-)))
|
||||
(when (or (-user-) (-group-))
|
||||
(print "current user id: " (current-user-id))
|
||||
(print "current effective user id: " (current-effective-user-id))
|
||||
(switch-user/group (-user-) (-group-))
|
||||
(print "current user id: " (current-user-id))
|
||||
(print "current effective user id: " (current-effective-user-id)))
|
||||
|
||||
(bar-db-init! (-db-name-) (-db-host-) (-db-user-) (-db-pass-))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue