~ubuntu-branches/ubuntu/karmic/postgresql-8.4/karmic-proposed

« back to all changes in this revision

Viewing changes to src/backend/libpq/hba.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-12-15 14:57:07 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20091215145707-4nbby6urklnwfqjf
Tags: 8.4.2-0ubuntu9.10
* New upstream security/bug fix release: (LP: #496923)
  - Protect against indirect security threats caused by index functions
    changing session-local state. This change prevents allegedly-immutable
    index functions from possibly subverting a superuser's session
    (CVE-2009-4136).
  - Reject SSL certificates containing an embedded null byte in the
    common name (CN) field. This prevents unintended matching of a
    certificate to a server or client name during SSL validation
    (CVE-2009-4034).
  - Fix hash index corruption. The 8.4 change that made hash indexes keep
    entries sorted by hash value failed to update the bucket splitting and
    compaction routines to preserve the ordering. So application of either
    of those operations could lead to permanent corruption of an index, in
    the sense that searches might fail to find entries that are present. To
    deal with this, it is recommended to REINDEX any hash indexes you may
    have after installing this update.
  - Fix possible crash during backend-startup-time cache initialization.
  - Avoid crash on empty thesaurus dictionary.
  - Prevent signals from interrupting VACUUM at unsafe times.
  - Fix possible crash due to integer overflow in hash table size
    calculation.
  - Fix crash if a DROP is attempted on an internally-dependent object.
  - Fix very rare crash in inet/cidr comparisons.
  - Ensure that shared tuple-level locks held by prepared transactions
    are not ignored.
  - Fix premature drop of temporary files used for a cursor that is
    accessed within a subtransaction.
  - Fix memory leak in syslogger process when rotating to a new CSV
    logfile.
  - Fix memory leak in postmaster when re-parsing "pg_hba.conf".
  - Make FOR UPDATE/SHARE in the primary query not propagate into WITH
    queries.
  - Fix bug with a WITH RECURSIVE query immediately inside another one.
  - Fix concurrency bug in hash indexes.
  - Fix incorrect logic for GiST index page splits, when the split
    depends on a non-first column of the index.
  - Fix wrong search results for a multi-column GIN index with
    fastupdate enabled.
  - Fix bugs in WAL entry creation for GIN indexes.
  - Don't error out if recycling or removing an old WAL file fails at
    the end of checkpoint.
  - Fix PAM password processing to be more robust.
    The previous code is known to fail with the combination of the
    Linux pam_krb5 PAM module with Microsoft Active Directory as the
    domain controller. It might have problems elsewhere too, since it
    was making unjustified assumptions about what arguments the PAM
    stack would pass to it.
  - Raise the maximum authentication token (Kerberos ticket) size in
    GSSAPI and SSPI authentication methods. While the old 2000-byte limit
    was more than enough for Unix Kerberos implementations, tickets issued
    by Windows Domain Controllers can be much larger.
  - Ensure that domain constraints are enforced in constructs like
    ARRAY[...]::domain, where the domain is over an array type.
  - Fix foreign-key logic for some cases involving composite-type
    columns as foreign keys.
  - Ensure that a cursor's snapshot is not modified after it is created.
  - Fix CREATE TABLE to properly merge default expressions coming from
    different inheritance parent tables. This used to work but was broken in
    8.4.
  - Re-enable collection of access statistics for sequences. This used to
    work but was broken in 8.3.
  - Fix processing of ownership dependencies during CREATE OR REPLACE
    FUNCTION.
  - Fix incorrect handling of WHERE "x"="x" conditions.
    In some cases these could get ignored as redundant, but they aren't
    -- they're equivalent to "x" IS NOT NULL.
  - Fix incorrect plan construction when using hash aggregation to
    implement DISTINCT for textually identical volatile expressions
  - Fix Assert failure for a volatile SELECT DISTINCT ON expression
  - Fix ts_stat() to not fail on an empty tsvector value
  - Make text search parser accept underscores in XML attributes
  - Fix encoding handling in xml binary input.
    If the XML header doesn't specify an encoding, we now assume UTF-8
    by default; the previous handling was inconsistent.
  - Fix bug with calling plperl from plperlu or vice versa.
  - Fix session-lifespan memory leak when a PL/Perl function is
    redefined.
  - Ensure that Perl arrays are properly converted to PostgreSQL arrays
    when returned by a set-returning PL/Perl function.
  - Fix rare crash in exception processing in PL/Python.
  - Fix ecpg problem with comments in DECLARE CURSOR statements
  - Fix ecpg to not treat recently-added keywords as reserved words
    This affected the keywords CALLED, CATALOG, DEFINER, ENUM,
    FOLLOWING, INVOKER, OPTIONS, PARTITION, PRECEDING, RANGE, SECURITY,
    SERVER, UNBOUNDED, and WRAPPER.
  - Re-allow regular expression special characters in psql's \df
    function name parameter.
  - Put FREEZE and VERBOSE options in the right order in the VACUUM
    command that "contrib/vacuumdb" produces.
  - Fix possible leak of connections when "contrib/dblink" encounters
    an error
  - Make the postmaster ignore any application_name parameter in
    connection request packets, to improve compatibility with future
    libpq versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 *
11
11
 *
12
12
 * IDENTIFICATION
13
 
 *        $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.188 2009/06/24 13:39:42 mha Exp $
 
13
 *        $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.188.2.1 2009/10/03 20:04:45 tgl Exp $
14
14
 *
15
15
 *-------------------------------------------------------------------------
16
16
 */
710
710
                                                                line_num, HbaFileName)));
711
711
                        return false;
712
712
                }
 
713
 
 
714
                /* need a modifiable copy of token */
713
715
                token = pstrdup(lfirst(line_item));
714
716
 
715
717
                /* Check if it has a CIDR suffix and if so isolate it */
736
738
                                                        token, gai_strerror(ret)),
737
739
                                         errcontext("line %d of configuration file \"%s\"",
738
740
                                                                line_num, HbaFileName)));
739
 
                        if (cidr_slash)
740
 
                                *cidr_slash = '/';
741
741
                        if (gai_result)
742
742
                                pg_freeaddrinfo_all(hints.ai_family, gai_result);
 
743
                        pfree(token);
743
744
                        return false;
744
745
                }
745
746
 
746
 
                if (cidr_slash)
747
 
                        *cidr_slash = '/';
748
 
 
749
747
                memcpy(&parsedline->addr, gai_result->ai_addr, gai_result->ai_addrlen);
750
748
                pg_freeaddrinfo_all(hints.ai_family, gai_result);
751
749
 
755
753
                        if (pg_sockaddr_cidr_mask(&parsedline->mask, cidr_slash + 1,
756
754
                                                                          parsedline->addr.ss_family) < 0)
757
755
                        {
 
756
                                *cidr_slash = '/';                      /* restore token for message */
758
757
                                ereport(LOG,
759
758
                                                (errcode(ERRCODE_CONFIG_FILE_ERROR),
760
759
                                                 errmsg("invalid CIDR mask in address \"%s\"",
761
760
                                                                token),
762
761
                                                 errcontext("line %d of configuration file \"%s\"",
763
762
                                                                        line_num, HbaFileName)));
 
763
                                pfree(token);
764
764
                                return false;
765
765
                        }
 
766
                        pfree(token);
766
767
                }
767
768
                else
768
769
                {
769
770
                        /* Read the mask field. */
 
771
                        pfree(token);
770
772
                        line_item = lnext(line_item);
771
773
                        if (!line_item)
772
774
                        {
1253
1255
}
1254
1256
 
1255
1257
/*
1256
 
 * Free the contents of a hba record
 
1258
 * Free an HbaLine structure
1257
1259
 */
1258
1260
static void
1259
1261
free_hba_record(HbaLine *record)
1262
1264
                pfree(record->database);
1263
1265
        if (record->role)
1264
1266
                pfree(record->role);
 
1267
        if (record->usermap)
 
1268
                pfree(record->usermap);
1265
1269
        if (record->pamservice)
1266
1270
                pfree(record->pamservice);
1267
1271
        if (record->ldapserver)
1274
1278
                pfree(record->krb_server_hostname);
1275
1279
        if (record->krb_realm)
1276
1280
                pfree(record->krb_realm);
 
1281
        pfree(record);
1277
1282
}
1278
1283
 
1279
1284
/*
1342
1347
                {
1343
1348
                        /* Parse error in the file, so indicate there's a problem */
1344
1349
                        free_hba_record(newline);
1345
 
                        pfree(newline);
 
1350
                        ok = false;
1346
1351
 
1347
1352
                        /*
1348
1353
                         * Keep parsing the rest of the file so we can report errors on
1349
1354
                         * more than the first row. Error has already been reported in the
1350
1355
                         * parsing function, so no need to log it here.
1351
1356
                         */
1352
 
                        ok = false;
1353
1357
                        continue;
1354
1358
                }
1355
1359
 
1356
1360
                new_parsed_lines = lappend(new_parsed_lines, newline);
1357
1361
        }
1358
1362
 
 
1363
        /* Free the temporary lists */
 
1364
        free_lines(&hba_lines, &hba_line_nums);
 
1365
 
1359
1366
        if (!ok)
1360
1367
        {
1361
1368
                /* Parsing failed at one or more rows, so bail out */
1367
1374
        clean_hba_list(parsed_hba_lines);
1368
1375
        parsed_hba_lines = new_parsed_lines;
1369
1376
 
1370
 
        /* Free the temporary lists */
1371
 
        free_lines(&hba_lines, &hba_line_nums);
1372
 
 
1373
1377
        return true;
1374
1378
}
1375
1379