diff --git a/dba/create-database.sh b/dba/create-database.sh index 0623f04a..a83b4ec2 100755 --- a/dba/create-database.sh +++ b/dba/create-database.sh @@ -1,12 +1,12 @@ #!/bin/sh # -# Build the CalDAV database +# Build the RSCDS database # -DBNAME="${1:-caldav}" +DBNAME="${1:-rscds}" createdb -E UTF8 "${DBNAME}" -psql -f caldav.sql "${DBNAME}" +psql -f rscds.sql "${DBNAME}" psql -f sample-data.sql "${DBNAME}" diff --git a/dba/caldav.sql b/dba/rscds.sql similarity index 91% rename from dba/caldav.sql rename to dba/rscds.sql index da300e73..9364f48b 100644 --- a/dba/caldav.sql +++ b/dba/rscds.sql @@ -1,4 +1,4 @@ --- My CalDAV server - Database Schema +-- Really Simple CalDAV Store - Database Schema -- -- Use the usr, group and schema management stufffrom libawl-php @@ -20,7 +20,8 @@ GRANT SELECT,INSERT,UPDATE,DELETE ON ics_event_data TO general; CREATE TABLE time_zones ( tzid TEXT PRIMARY KEY, location TEXT, - tz_spec TEXT + tz_spec TEXT, + pgtz TEXT ); GRANT SELECT,INSERT ON time_zones TO general; @@ -30,7 +31,7 @@ CREATE TABLE ical_events ( ics_event_name TEXT, ics_event_etag TEXT, - -- Extracted iCalendar event data + -- Extracted vEvent event data uid TEXT, dtstamp TEXT, dtstart TIMESTAMP, diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 00000000..2cc3c2b9 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,4 @@ +compat +files +html +rscds diff --git a/debian/control b/debian/control index 5c43459d..a7e3fee3 100644 --- a/debian/control +++ b/debian/control @@ -2,12 +2,12 @@ Source: rscds Section: catalyst Priority: extra Maintainer: Andrew McMillan -Standards-Version: 3.5.9 +Standards-Version: 3.6.3 Build-Depends: debhelper Package: rscds Architecture: all -Depends: debconf (>= 1.0.32), php4 (>= 4:4.1), php4-pgsql(>= 3:4.1.0), postgresql-client (>= 7.2.1) | postgresql-client-8.0 | postgresql-client-8.1, libawl-php (>=0.1-1) +Depends: debconf (>= 1.0.32), php4 (>= 4:4.3) | php5, php4-pgsql(>= 3:4.3.0) | php5-pgsql, postgresql-client-8.0 | postgresql-client-8.1, libawl-php (>=0.3-1) Description: Really Simple CalDAV Server The Really Simple CalDAV Server is designed to trivially store CalDAV calendars, such as those from Evolution, in a central diff --git a/debian/rscds-phpdoc.ini b/debian/rscds-phpdoc.ini index 0587fa7d..40fc3c1b 100644 --- a/debian/rscds-phpdoc.ini +++ b/debian/rscds-phpdoc.ini @@ -71,7 +71,7 @@ readmeinstallchangelog = README, INSTALL, CHANGELOG, NEWS, FAQ, LICENSE ;; legal values: directory paths separated by commas ;directory = /path1,/path2,.,..,subdirectory ;directory = /home/jeichorn/cvs/pear -directory = /home/andrew/projects/rscds/inc,/home/andrew/projects/rscds/html +directory = /home/andrew/projects/rscds/inc,/home/andrew/projects/rscds/htdocs ;; template base directory (the equivalent directory of /phpDocumentor) ;templatebase = /path/to/my/templates @@ -83,7 +83,7 @@ examplesdir = /home/andrew/projects/rscds/examples ;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore ;; legal values: any wildcard strings separated by commas ;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/ -ignore = api/,CVS +ignore = .git ;; comma-separated list of Converters to use in outputformat:Convertername:templatedirectory format ;; legal values: HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib, diff --git a/debian/rscds.docs b/debian/rscds.docs new file mode 100644 index 00000000..6c4c81de --- /dev/null +++ b/debian/rscds.docs @@ -0,0 +1,4 @@ +README +TODO +docs/ +debian/html/ diff --git a/debian/rules b/debian/rules index af456227..fec8a8dc 100755 --- a/debian/rules +++ b/debian/rules @@ -5,7 +5,7 @@ package=rscds dt=debian/$(package) -build: inc htdocs +build: inc htdocs debian/$(package)-phpdoc.ini $(checkdir) cd ~andrew/projects/phpdoc/phpDocumentor-1.2.3 && ./phpdoc -c ~andrew/projects/$(package)/debian/$(package)-phpdoc.ini touch build diff --git a/inc/session-util.php b/inc/session-util.php new file mode 100644 index 00000000..46646bbf --- /dev/null +++ b/inc/session-util.php @@ -0,0 +1,55 @@ + +* @copyright Catalyst IT Ltd +* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 +*/ + +if ( !function_exists("session_salted_md5") ) { + /** + * Make a salted MD5 string, given a string and (possibly) a salt. + * + * If no salt is supplied we will generate a random one. + * + * @param string $instr The string to be salted and MD5'd + * @param string $salt Some salt to sprinkle into the string to be MD5'd so we don't get the same PW always hashing to the same value. + * @return string The salt, a * and the MD5 of the salted string, as in SALT*SALTEDHASH + */ + function session_salted_md5( $instr, $salt = "" ) { + if ( $salt == "" ) $salt = substr( md5(rand(100000,999999)), 2, 8); + dbg_error_log( "Login: Making salted MD5: salt=$salt, instr=$instr, md5($salt$instr)=".md5($salt . $instr) ); + return ( sprintf("*%s*%s", $salt, md5($salt . $instr) ) ); + } +} + + +if ( !function_exists("session_validate_password") ) { + /** + * Checks what a user entered against the actual password on their account. + * @param string $they_sent What the user entered. + * @param string $we_have What we have in the database as their password. Which may (or may not) be a salted MD5. + * @return boolean Whether or not the users attempt matches what is already on file. + */ + function session_validate_password( $they_sent, $we_have ) { + global $debuggroups, $session; + + if ( ereg('^\*\*.+$', $we_have ) ) { + // The "forced" style of "**plaintext" to allow easier admin setting + return ( "**$they_sent" == $we_have ); + } + + if ( ereg('^\*(.+)\*.+$', $we_have, $regs ) ) { + // A nicely salted md5sum like "**" + $salt = $regs[1]; + $md5_sent = session_salted_md5( $they_sent, $salt ) ; + return ( $md5_sent == $we_have ); + } + + // Anything else is bad + return false; + + } +} +?> \ No newline at end of file diff --git a/rscds.webprj b/rscds.webprj index 8054829f..60dc3522 100644 --- a/rscds.webprj +++ b/rscds.webprj @@ -17,7 +17,6 @@ - @@ -27,7 +26,8 @@ - - + + +