~ubuntu-branches/ubuntu/utopic/389-ds-base/utopic-proposed

« back to all changes in this revision

Viewing changes to ldap/servers/slapd/back-ldbm/dbversion.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2014-02-03 11:08:50 UTC
  • mfrom: (0.2.1)
  • Revision ID: package-import@ubuntu.com-20140203110850-tjzx85elnke9fiu3
Tags: 1.3.2.9-1
* New upstream release.
  - fixes CVE-2013-0336 (Closes: #704077)
  - fixes CVE-2013-1897 (Closes: #704421)
  - fixes CVE-2013-2219 (Closes: #718325)
  - fixes CVE-2013-4283 (Closes: #721222)
  - fixes CVE-2013-4485 (Closes: #730115)
* Drop fix-CVE-2013-0312.diff, upstream.
* rules: Add new scripts to rename.
* fix-sasl-path.diff: Use a triplet path to find libsasl2. (LP:
  #1088822)
* admin_scripts.diff: Add patch from upstream #47511 to fix bashisms.
* control: Add ldap-utils to -base depends.
* rules, rename-online-scripts.diff: Some scripts with .pl suffix are
  meant for an online server, so instead of overwriting the offline
  scripts use -online suffix.
* rules: Enable parallel build, but limit the jobs to 1 for
  dh_auto_install.
* control: Bump policy to 3.9.5, no changes.
* rules: Add get-orig-source target.
* lintian-overrides: Drop obsolete entries, add comments for the rest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
            ptr = buf + len;
120
120
        }
121
121
        if (flags & DBVERSION_DNFORMAT) {
122
 
            PR_snprintf(ptr, sizeof(buf) - len, "/%s", BDB_DNFORMAT);
 
122
            PR_snprintf(ptr, sizeof(buf) - len, "/%s-%s",
 
123
                        BDB_DNFORMAT, BDB_DNFORMAT_VERSION);
123
124
            len = strlen(buf);
124
125
            ptr = buf + len;
125
126
        }
159
160
{
160
161
    char filename[ MAXPATHLEN*2 ];
161
162
    PRFileDesc *prfd;
162
 
    int rc = -1;
163
163
    char * iter = NULL;
 
164
    PRFileInfo64 fileinfo;
 
165
    int rc;
164
166
 
165
167
    if (!is_fullpath((char *)directory)) {
166
 
        return rc;
 
168
        return ENOENT;
167
169
    }
168
170
 
169
171
    if (NULL == ldbmversion) {
170
 
        return rc;
 
172
        return EINVAL;
 
173
    }
 
174
 
 
175
    rc = PR_GetFileInfo64(directory, &fileinfo);
 
176
    if ((rc != PR_SUCCESS) || (fileinfo.type != PR_FILE_DIRECTORY)) {
 
177
        /* Directory does not exist or not a directory. */
 
178
        return ENOENT;
171
179
    }
172
180
 
173
181
    mk_dbversion_fullpath(li, directory, filename);
174
182
    
175
183
    /* Open the file */
176
 
    if (( prfd = PR_Open( filename, PR_RDONLY, SLAPD_DEFAULT_FILE_MODE  )) ==
177
 
          NULL )
178
 
    {
 
184
    prfd = PR_Open(filename, PR_RDONLY, SLAPD_DEFAULT_FILE_MODE);
 
185
    if (prfd == NULL) {
179
186
        /* File missing... we are probably creating a new database. */
180
 
    }
181
 
    else
182
 
    {
 
187
        return EACCES;
 
188
    } else {
183
189
        char buf[LDBM_VERSION_MAXBUF];
184
 
        PRInt32 nr = slapi_read_buffer( prfd, buf,
185
 
                    (PRInt32)LDBM_VERSION_MAXBUF-1 );
 
190
        PRInt32 nr = slapi_read_buffer(prfd, buf, (PRInt32)LDBM_VERSION_MAXBUF-1);
186
191
        if ( nr > 0 && nr != (PRInt32)LDBM_VERSION_MAXBUF-1 )
187
192
        {
188
193
            char *t;
199
204
            }
200
205
        }
201
206
        (void)PR_Close( prfd );
202
 
        rc= 0;
 
207
        return 0;
203
208
    }
204
 
    return rc;
205
209
}
206
210
 
207
211