|
@@ -30,6 +30,7 @@ type userImport struct {
|
30
|
30
|
RegisteredAt int64 `json:"registeredAt"`
|
31
|
31
|
Vhost string
|
32
|
32
|
AdditionalNicks []string `json:"additionalNicks"`
|
|
33
|
+ Certfps []string
|
33
|
34
|
}
|
34
|
35
|
|
35
|
36
|
type channelImport struct {
|
|
@@ -83,9 +84,19 @@ func doImportDBGeneric(config *Config, dbImport databaseImport, credsType Creden
|
83
|
84
|
log.Printf("invalid username %s: %v", username, err)
|
84
|
85
|
continue
|
85
|
86
|
}
|
|
87
|
+ var certfps []string
|
|
88
|
+ for _, certfp := range userInfo.Certfps {
|
|
89
|
+ normalizedCertfp, err := utils.NormalizeCertfp(certfp)
|
|
90
|
+ if err == nil {
|
|
91
|
+ certfps = append(certfps, normalizedCertfp)
|
|
92
|
+ } else {
|
|
93
|
+ log.Printf("invalid certfp %s for %s\n", username, certfp)
|
|
94
|
+ }
|
|
95
|
+ }
|
86
|
96
|
credentials := AccountCredentials{
|
87
|
97
|
Version: credsType,
|
88
|
98
|
PassphraseHash: []byte(userInfo.Hash),
|
|
99
|
+ Certfps: certfps,
|
89
|
100
|
}
|
90
|
101
|
marshaledCredentials, err := json.Marshal(&credentials)
|
91
|
102
|
if err != nil {
|
|
@@ -104,6 +115,9 @@ func doImportDBGeneric(config *Config, dbImport databaseImport, credsType Creden
|
104
|
115
|
if len(userInfo.AdditionalNicks) != 0 {
|
105
|
116
|
tx.Set(fmt.Sprintf(keyAccountAdditionalNicks, cfUsername), marshalReservedNicks(userInfo.AdditionalNicks), nil)
|
106
|
117
|
}
|
|
118
|
+ for _, certfp := range certfps {
|
|
119
|
+ tx.Set(fmt.Sprintf(keyCertToAccount, certfp), cfUsername, nil)
|
|
120
|
+ }
|
107
|
121
|
}
|
108
|
122
|
|
109
|
123
|
for chname, chInfo := range dbImport.Channels {
|