~ubuntu-branches/ubuntu/precise/nss/precise-security

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/jar/jarint.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-11-14 14:58:07 UTC
  • mfrom: (1.1.19)
  • Revision ID: package-import@ubuntu.com-20131114145807-ay302kimn72ovt88
Tags: 3.15.3-0ubuntu0.12.04.1
* SECURITY UPDATE: New upstream release to fix multiple security issues
  and add TLSv1.2 support.
  - CVE-2013-1739
  - CVE-2013-1741
  - CVE-2013-5605
  - CVE-2013-5606
* Adjusted packaging for 3.15.3:
  - debian/patches/*: refreshed.
  - debian/patches/lower-dhe-priority.patch: removed, no longer needed,
    was a workaround for an old version of firefox.
  - debian/libnss3.symbols: added new symbols.
  - debian/rules: updated for new source layout.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
 
 
5
 
/*
6
 
 * Internal libjar routines.
7
 
 */
8
 
 
9
 
#include "jar.h"
10
 
#include "jarint.h"
11
 
 
12
 
/*-----------------------------------------------------------------------
13
 
 * JAR_FOPEN_to_PR_Open
14
 
 * Translate JAR_FOPEN arguments to PR_Open arguments
15
 
 */
16
 
PRFileDesc*
17
 
JAR_FOPEN_to_PR_Open(const char* name, const char *mode)
18
 
{
19
 
 
20
 
    PRIntn  prflags=0, prmode=0;
21
 
 
22
 
    /* Get read/write flags */
23
 
    if (strchr(mode, 'r') && !strchr(mode, '+')) {
24
 
        prflags |= PR_RDONLY;
25
 
    } else if( (strchr(mode, 'w') || strchr(mode, 'a')) &&
26
 
        !strchr(mode,'+') ) {
27
 
        prflags |= PR_WRONLY;
28
 
    } else {
29
 
        prflags |= PR_RDWR;
30
 
    }
31
 
 
32
 
    /* Create a new file? */
33
 
    if (strchr(mode, 'w') || strchr(mode, 'a')) {
34
 
        prflags |= PR_CREATE_FILE;
35
 
    }
36
 
 
37
 
    /* Append? */
38
 
    if (strchr(mode, 'a')) {
39
 
        prflags |= PR_APPEND;
40
 
    }
41
 
 
42
 
    /* Truncate? */
43
 
    if (strchr(mode, 'w')) {
44
 
        prflags |= PR_TRUNCATE;
45
 
    }
46
 
 
47
 
    /* We can't do umask because it isn't XP.  Choose some default
48
 
           mode for created files */
49
 
    prmode = 0755;
50
 
 
51
 
    return PR_Open(name, prflags, prmode);
52
 
}