| 1152 | } |
| 1153 | |
| 1154 | func mergeKeywords(oldKeywords *wconfig.ConnKeywords, newKeywords *wconfig.ConnKeywords) *wconfig.ConnKeywords { |
| 1155 | if oldKeywords == nil { |
| 1156 | oldKeywords = &wconfig.ConnKeywords{} |
| 1157 | } |
| 1158 | if newKeywords == nil { |
| 1159 | return oldKeywords |
| 1160 | } |
| 1161 | outKeywords := *oldKeywords |
| 1162 | |
| 1163 | if newKeywords.SshHostName != nil { |
| 1164 | outKeywords.SshHostName = newKeywords.SshHostName |
| 1165 | } |
| 1166 | if newKeywords.SshUser != nil { |
| 1167 | outKeywords.SshUser = newKeywords.SshUser |
| 1168 | } |
| 1169 | if newKeywords.SshPort != nil { |
| 1170 | outKeywords.SshPort = newKeywords.SshPort |
| 1171 | } |
| 1172 | // skip identityfile (handled separately due to different behavior) |
| 1173 | if newKeywords.SshBatchMode != nil { |
| 1174 | outKeywords.SshBatchMode = newKeywords.SshBatchMode |
| 1175 | } |
| 1176 | if newKeywords.SshPubkeyAuthentication != nil { |
| 1177 | outKeywords.SshPubkeyAuthentication = newKeywords.SshPubkeyAuthentication |
| 1178 | } |
| 1179 | if newKeywords.SshPasswordAuthentication != nil { |
| 1180 | outKeywords.SshPasswordAuthentication = newKeywords.SshPasswordAuthentication |
| 1181 | } |
| 1182 | if newKeywords.SshKbdInteractiveAuthentication != nil { |
| 1183 | outKeywords.SshKbdInteractiveAuthentication = newKeywords.SshKbdInteractiveAuthentication |
| 1184 | } |
| 1185 | if newKeywords.SshPreferredAuthentications != nil { |
| 1186 | outKeywords.SshPreferredAuthentications = newKeywords.SshPreferredAuthentications |
| 1187 | } |
| 1188 | if newKeywords.SshAddKeysToAgent != nil { |
| 1189 | outKeywords.SshAddKeysToAgent = newKeywords.SshAddKeysToAgent |
| 1190 | } |
| 1191 | if newKeywords.SshIdentityAgent != nil { |
| 1192 | outKeywords.SshIdentityAgent = newKeywords.SshIdentityAgent |
| 1193 | } |
| 1194 | if newKeywords.SshIdentitiesOnly != nil { |
| 1195 | outKeywords.SshIdentitiesOnly = newKeywords.SshIdentitiesOnly |
| 1196 | } |
| 1197 | if newKeywords.SshProxyJump != nil { |
| 1198 | outKeywords.SshProxyJump = newKeywords.SshProxyJump |
| 1199 | } |
| 1200 | if newKeywords.SshUserKnownHostsFile != nil { |
| 1201 | outKeywords.SshUserKnownHostsFile = newKeywords.SshUserKnownHostsFile |
| 1202 | } |
| 1203 | if newKeywords.SshGlobalKnownHostsFile != nil { |
| 1204 | outKeywords.SshGlobalKnownHostsFile = newKeywords.SshGlobalKnownHostsFile |
| 1205 | } |
| 1206 | if newKeywords.SshPasswordSecretName != nil { |
| 1207 | outKeywords.SshPasswordSecretName = newKeywords.SshPasswordSecretName |
| 1208 | } |
| 1209 | |
| 1210 | return &outKeywords |
| 1211 | } |