Lines Matching +full:loss +full:- +full:of +full:- +full:lock
2 * Copyright (c) 2005 - 2006 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
14 * notice, this list of conditions and the following disclaimer in the
17 * 3. Neither the name of the Institute nor the names of its contributors
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 hx509_lock_init(hx509_context context, hx509_lock *lock) in hx509_lock_init() argument
65 *lock = NULL; in hx509_lock_init()
72 "MEMORY:locks-internal", in hx509_lock_init()
75 &l->certs); in hx509_lock_init()
81 *lock = l; in hx509_lock_init()
87 hx509_lock_add_password(hx509_lock lock, const char *password) in hx509_lock_add_password() argument
96 d = realloc(lock->password.val, in hx509_lock_add_password()
97 (lock->password.len + 1) * sizeof(lock->password.val[0])); in hx509_lock_add_password()
102 lock->password.val = d; in hx509_lock_add_password()
103 lock->password.val[lock->password.len] = s; in hx509_lock_add_password()
104 lock->password.len++; in hx509_lock_add_password()
110 _hx509_lock_get_passwords(hx509_lock lock) in _hx509_lock_get_passwords() argument
112 return &lock->password; in _hx509_lock_get_passwords()
116 _hx509_lock_unlock_certs(hx509_lock lock) in _hx509_lock_unlock_certs() argument
118 return lock->certs; in _hx509_lock_unlock_certs()
122 hx509_lock_reset_passwords(hx509_lock lock) in hx509_lock_reset_passwords() argument
125 for (i = 0; i < lock->password.len; i++) in hx509_lock_reset_passwords()
126 free(lock->password.val[i]); in hx509_lock_reset_passwords()
127 free(lock->password.val); in hx509_lock_reset_passwords()
128 lock->password.val = NULL; in hx509_lock_reset_passwords()
129 lock->password.len = 0; in hx509_lock_reset_passwords()
133 hx509_lock_add_cert(hx509_context context, hx509_lock lock, hx509_cert cert) in hx509_lock_add_cert() argument
135 return hx509_certs_add(context, lock->certs, cert); in hx509_lock_add_cert()
139 hx509_lock_add_certs(hx509_context context, hx509_lock lock, hx509_certs certs) in hx509_lock_add_certs() argument
141 return hx509_certs_merge(context, lock->certs, certs); in hx509_lock_add_certs()
145 hx509_lock_reset_certs(hx509_context context, hx509_lock lock) in hx509_lock_reset_certs() argument
147 hx509_certs certs = lock->certs; in hx509_lock_reset_certs()
151 "MEMORY:locks-internal", in hx509_lock_reset_certs()
154 &lock->certs); in hx509_lock_reset_certs()
158 lock->certs = certs; in hx509_lock_reset_certs()
162 _hx509_lock_find_cert(hx509_lock lock, const hx509_query *q, hx509_cert *c) in _hx509_lock_find_cert() argument
169 hx509_lock_set_prompter(hx509_lock lock, hx509_prompter_fct prompt, void *data) in hx509_lock_set_prompter() argument
171 lock->prompt = prompt; in hx509_lock_set_prompter()
172 lock->prompt_data = data; in hx509_lock_set_prompter()
177 hx509_lock_reset_promper(hx509_lock lock) in hx509_lock_reset_promper() argument
179 lock->prompt = NULL; in hx509_lock_reset_promper()
180 lock->prompt_data = NULL; in hx509_lock_reset_promper()
186 if (hx509_prompt_hidden(prompter->type)) { in default_prompter()
187 if(UI_UTIL_read_pw_string(prompter->reply.data, in default_prompter()
188 prompter->reply.length, in default_prompter()
189 prompter->prompt, in default_prompter()
193 char *s = prompter->reply.data; in default_prompter()
195 fputs (prompter->prompt, stdout); in default_prompter()
197 if(fgets(prompter->reply.data, in default_prompter()
198 prompter->reply.length, in default_prompter()
207 hx509_lock_prompt(hx509_lock lock, hx509_prompt *prompt) in hx509_lock_prompt() argument
209 if (lock->prompt == NULL) in hx509_lock_prompt()
211 return (*lock->prompt)(lock->prompt_data, prompt); in hx509_lock_prompt()
215 hx509_lock_free(hx509_lock lock) in hx509_lock_free() argument
217 if (lock) { in hx509_lock_free()
218 hx509_certs_free(&lock->certs); in hx509_lock_free()
219 hx509_lock_reset_passwords(lock); in hx509_lock_free()
220 memset(lock, 0, sizeof(*lock)); in hx509_lock_free()
221 free(lock); in hx509_lock_free()
240 hx509_lock_command_string(hx509_lock lock, const char *string) in hx509_lock_command_string() argument
243 hx509_lock_add_password(lock, string + 5); in hx509_lock_command_string()
245 hx509_lock_set_prompter(lock, default_prompter, NULL); in hx509_lock_command_string()