~ubuntu-branches/ubuntu/vivid/wpasupplicant/vivid

« back to all changes in this revision

Viewing changes to x509v3.c

  • Committer: Bazaar Package Importer
  • Author(s): Kel Modderman
  • Date: 2006-10-05 08:04:01 UTC
  • mfrom: (1.1.5 upstream) (3 etch)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061005080401-r8lqlix4390yos7b
Tags: 0.5.5-2
* Update madwifi headers to latest SVN. (Closes: #388316)
* Remove failed attempt at action locking. [debian/functions.sh,
  debian/wpa_action.sh]
* Add hysteresis checking functions, to avoid "event loops" while
  using wpa-roam. [debian/functions.sh, debian/wpa_action.sh]
* Change of co-maintainer email address.
* Add ishex() function to functions.sh to determine wpa-psk value type in
  plaintext or hex. This effectively eliminates the need for the bogus and
  somewhat confusing wpa-passphrase contruct specific to our scripts and
  allows wpa-psk to work with either a 8 to 63 character long plaintext
  string or 64 character long hex string.
* Adjust README.modes to not refer to the redundant wpa-passphrase stuff.
* Add big fat NOTE about acceptable wpa-psk's to top of example gallery.
* Strip surrounding quotes from wpa-ssid if present, instead of just whining
  about them.
* Update email address in copyright blurb of functions.sh, ifupdown.sh and
  wpa_action.sh.  

Show diffs side-by-side

added added

removed removed

Lines of Context:
292
292
void x509_name_string(struct x509_name *name, char *buf, size_t len)
293
293
{
294
294
        char *pos, *end;
 
295
        int ret;
 
296
 
 
297
        if (len == 0)
 
298
                return;
295
299
 
296
300
        pos = buf;
297
301
        end = buf + len;
298
302
 
299
 
        if (name->c)
300
 
                pos += snprintf(pos, end - pos, "C=%s, ", name->c);
301
 
        if (name->st)
302
 
                pos += snprintf(pos, end - pos, "ST=%s, ", name->st);
303
 
        if (name->l)
304
 
                pos += snprintf(pos, end - pos, "L=%s, ", name->l);
305
 
        if (name->o)
306
 
                pos += snprintf(pos, end - pos, "O=%s, ", name->o);
307
 
        if (name->ou)
308
 
                pos += snprintf(pos, end - pos, "OU=%s, ", name->ou);
309
 
        if (name->cn)
310
 
                pos += snprintf(pos, end - pos, "CN=%s, ", name->cn);
 
303
        if (name->c) {
 
304
                ret = snprintf(pos, end - pos, "C=%s, ", name->c);
 
305
                if (ret < 0 || ret >= end - pos)
 
306
                        goto done;
 
307
                pos += ret;
 
308
        }
 
309
        if (name->st) {
 
310
                ret = snprintf(pos, end - pos, "ST=%s, ", name->st);
 
311
                if (ret < 0 || ret >= end - pos)
 
312
                        goto done;
 
313
                pos += ret;
 
314
        }
 
315
        if (name->l) {
 
316
                ret = snprintf(pos, end - pos, "L=%s, ", name->l);
 
317
                if (ret < 0 || ret >= end - pos)
 
318
                        goto done;
 
319
                pos += ret;
 
320
        }
 
321
        if (name->o) {
 
322
                ret = snprintf(pos, end - pos, "O=%s, ", name->o);
 
323
                if (ret < 0 || ret >= end - pos)
 
324
                        goto done;
 
325
                pos += ret;
 
326
        }
 
327
        if (name->ou) {
 
328
                ret = snprintf(pos, end - pos, "OU=%s, ", name->ou);
 
329
                if (ret < 0 || ret >= end - pos)
 
330
                        goto done;
 
331
                pos += ret;
 
332
        }
 
333
        if (name->cn) {
 
334
                ret = snprintf(pos, end - pos, "CN=%s, ", name->cn);
 
335
                if (ret < 0 || ret >= end - pos)
 
336
                        goto done;
 
337
                pos += ret;
 
338
        }
311
339
 
312
340
        if (pos > buf + 1 && pos[-1] == ' ' && pos[-2] == ',') {
313
341
                *pos-- = '\0';
315
343
        }
316
344
 
317
345
        if (name->email) {
318
 
                pos += snprintf(pos, end - pos, "/emailAddress=%s",
319
 
                                name->email);
 
346
                ret = snprintf(pos, end - pos, "/emailAddress=%s",
 
347
                               name->email);
 
348
                if (ret < 0 || ret >= end - pos)
 
349
                        goto done;
 
350
                pos += ret;
320
351
        }
 
352
 
 
353
done:
 
354
        end[-1] = '\0';
321
355
}
322
356
 
323
357