libidav/pwdstore.c

changeset 842
10ee615ca557
parent 841
21403bdaf54c
equal deleted inserted replaced
841:21403bdaf54c 842:10ee615ca557
138 newp->isdecrypted = p->isdecrypted; 138 newp->isdecrypted = p->isdecrypted;
139 139
140 CxIterator i = cxMapIterator(p->ids); 140 CxIterator i = cxMapIterator(p->ids);
141 cx_foreach(CxMapEntry *, e, i) { 141 cx_foreach(CxMapEntry *, e, i) {
142 PwdEntry *entry = e->value; 142 PwdEntry *entry = e->value;
143 PwdEntry *new_entry = malloc(sizeof(PwdEntry)); 143 pwdstore_put(newp, entry->id, entry->user, entry->password);
144 new_entry->id = strdup(entry->id);
145 new_entry->user = entry->user ? strdup(entry->user) : NULL;
146 new_entry->password = entry->password ? strdup(entry->password) : NULL;
147 cxMapPut(newp->ids, *e->key, new_entry);
148 } 144 }
149 145
150 i = cxMapIterator(p->index); 146 i = cxMapIterator(p->index);
151 cx_foreach(CxMapEntry *, e, i) { 147 cx_foreach(CxMapEntry *, e, i) {
152 PwdIndexEntry *entry = e->value; 148 PwdIndexEntry *entry = e->value;
156 CxIterator li = cxListIterator(entry->locations); 152 CxIterator li = cxListIterator(entry->locations);
157 cx_foreach(char *, location, li) { 153 cx_foreach(char *, location, li) {
158 cxListAdd(locations, strdup(location)); 154 cxListAdd(locations, strdup(location));
159 } 155 }
160 } 156 }
161 pwdstore_put_index(newp, entry->id, locations); 157 pwdstore_put_index(newp, strdup(entry->id), locations);
162 } 158 }
163 159
164 return newp; 160 return newp;
165 } 161 }
166 162

mercurial