external: SETCREDS include creds in externalConfigChanges
This makes the creds get saved, since only things recorded there will be saved. IIRC, unparsedRemoteConfig was not originally available when I implemented this; now that it is things get a bit simpler. More could probably be simplified, is externalConfigChanges needed at all? This does not entirely fix the bugs though, because creds are only embedded when embedcreds=yes, but not when encryption=pubkey is used without embedcreds=yes.
This commit is contained in:
parent
9fb549b3f1
commit
a1d4c8e4ec
4 changed files with 40 additions and 19 deletions
|
@ -420,7 +420,7 @@ handleRequest' st external req mp responsehandler
|
|||
c
|
||||
in ParsedRemoteConfig m' c'
|
||||
modifyTVar' (externalConfigChanges st) $ \f ->
|
||||
f . M.insert (Accepted setting) (Accepted value)
|
||||
M.insert (Accepted setting) (Accepted value) . f
|
||||
handleRemoteRequest (GETCONFIG setting) = do
|
||||
value <- maybe "" fromProposedAccepted
|
||||
. (M.lookup (Accepted setting))
|
||||
|
@ -430,11 +430,18 @@ handleRequest' st external req mp responsehandler
|
|||
handleRemoteRequest (SETCREDS setting login password) = case (externalUUID external, externalGitConfig external) of
|
||||
(Just u, Just gc) -> do
|
||||
let v = externalConfig st
|
||||
(ParsedRemoteConfig m c) <- liftIO $ atomically $ readTVar v
|
||||
m' <- setRemoteCredPair' RemoteConfigValue (\m' -> ParsedRemoteConfig m' c) encryptionAlreadySetup m gc
|
||||
pc <- liftIO $ atomically $ readTVar v
|
||||
pc' <- setRemoteCredPair' pc encryptionAlreadySetup gc
|
||||
(credstorage setting u)
|
||||
(Just (login, password))
|
||||
void $ liftIO $ atomically $ swapTVar v (ParsedRemoteConfig m' c)
|
||||
let configchanges = M.differenceWithKey
|
||||
(\_k a b -> if a == b then Nothing else Just a)
|
||||
(unparsedRemoteConfig pc')
|
||||
(unparsedRemoteConfig pc)
|
||||
void $ liftIO $ atomically $ do
|
||||
_ <- swapTVar v pc'
|
||||
modifyTVar' (externalConfigChanges st) $ \f ->
|
||||
M.union configchanges . f
|
||||
_ -> senderror "cannot send SETCREDS here"
|
||||
handleRemoteRequest (GETCREDS setting) = case (externalUUID external, externalGitConfig external) of
|
||||
(Just u, Just gc) -> do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue