aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--network/users-agent/README2
-rw-r--r--network/users-agent/doinst.sh26
-rw-r--r--network/users-agent/rc.users-agent29
-rw-r--r--network/users-agent/slack-desc19
-rw-r--r--network/users-agent/users-agent.SlackBuild96
-rw-r--r--network/users-agent/users-agent.info10
-rw-r--r--network/users-agent/users-agent.vcard.patch135
7 files changed, 317 insertions, 0 deletions
diff --git a/network/users-agent/README b/network/users-agent/README
new file mode 100644
index 000000000000..384333b97019
--- /dev/null
+++ b/network/users-agent/README
@@ -0,0 +1,2 @@
+A Perl based Jabber User Directory. Currently the one running on
+users.jabber.org.
diff --git a/network/users-agent/doinst.sh b/network/users-agent/doinst.sh
new file mode 100644
index 000000000000..adc03f2ca076
--- /dev/null
+++ b/network/users-agent/doinst.sh
@@ -0,0 +1,26 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+config etc/users-agent/config.xml.new
+preserve_perms etc/rc.d/rc.users-agent.new
diff --git a/network/users-agent/rc.users-agent b/network/users-agent/rc.users-agent
new file mode 100644
index 000000000000..304eca03dcc7
--- /dev/null
+++ b/network/users-agent/rc.users-agent
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+users_agent_start() {
+ if [ ! -e /var/run/users-agent/jud.pid ]; then
+ su - %JUDUSR% -c "/usr/bin/users-agent -c /etc/users-agent/config.xml &"
+ su - %JUDUSR% -c "ps ux" | awk '/users-agent/ && !/awk/ {print $2}' > /var/run/users-agent/jud.pid
+ fi
+}
+
+users_agent_stop() {
+ kill `cat /var/run/users-agent/jud.pid 2> /dev/null` 2> /dev/null
+ rm -rf /var/run/users-agent/jud.pid 2> /dev/null
+}
+
+case $1 in
+'start')
+ users_agent_start
+ ;;
+'stop')
+ users_agent_stop
+ ;;
+'restart')
+ users_agent_stop
+ sleep 2
+ users_agent_start
+ ;;
+*)
+ echo "usage: `basename $0` {start|stop|restart}"
+esac
diff --git a/network/users-agent/slack-desc b/network/users-agent/slack-desc
new file mode 100644
index 000000000000..2d6f1597bde2
--- /dev/null
+++ b/network/users-agent/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+users-agent: users-agent (Jabber User Directory)
+users-agent:
+users-agent: A Perl based Jabber User Directory. Currently the one running on
+users-agent: users.jabber.org.
+users-agent:
+users-agent: Homepage:
+users-agent: http://www.jabberstudio.org/projects/users-agent/project/view.php
+users-agent:
+users-agent:
+users-agent:
+users-agent:
diff --git a/network/users-agent/users-agent.SlackBuild b/network/users-agent/users-agent.SlackBuild
new file mode 100644
index 000000000000..1b6f06f9169a
--- /dev/null
+++ b/network/users-agent/users-agent.SlackBuild
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+# Slackware build script for users-agent
+
+# Copyright 2013 Christopher Walker Copperas Cove, TX
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=users-agent
+VERSION=${VERSION:-1.2}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+ARCH=noarch
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+JUDUSR=${JUDUSR:-jabber}
+JUDGRP=${JUDGRP:-jabber}
+JUDUID=${JUDUID:-275}
+JUDGID=${JUDGID:-275}
+
+do_exit() {
+ echo ; echo "You must have the ${JUDUSR} user and ${JUDGRP} group in"
+ echo "order to build amanda. Sample lines to do so are below:"
+ echo "# groupadd -g ${JUDGID} ${JUDGRP}"
+ echo "# useradd -u ${JUDUID} -g ${JUDGRP} ${JUDUSR}"
+ echo "Exiting..." ; echo ; exit 1
+}
+
+# Check for Amanada user and group availability
+if ! getent group | grep -q ^${JUDGRP}: 2>/dev/null ; then
+ do_exit;
+elif ! getent passwd | grep -q ^${JUDUSR}: 2>/dev/null ; then
+ do_exit;
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/Users-Agent-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+mkdir -p $PKG/usr/bin
+install -o root -g root -m 755 -T users-agent $PKG/usr/bin/users-agent
+
+mkdir -p $PKG/etc/{rc.d,users-agent}
+install -o root -g $JUDGRP -m 640 -T config.xml $PKG/etc/users-agent/config.xml.new
+sed -e "s/%JUDUSR%/$JUDUSR/g" $CWD/rc.users-agent >> $PKG/etc/rc.d/rc.users-agent.new
+
+mkdir -p $PKG/var/run/users-agent
+chown $JUDUSR.$JUDGRP $PKG/var/run/users-agent
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/tools
+cp -a \
+ CHANGES INSTALL README \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ createDB $CWD/users-agent.vcard.patch \
+ $PKG/usr/doc/$PRGNAM-$VERSION/tools
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/network/users-agent/users-agent.info b/network/users-agent/users-agent.info
new file mode 100644
index 000000000000..c3a4748a8c24
--- /dev/null
+++ b/network/users-agent/users-agent.info
@@ -0,0 +1,10 @@
+PRGNAM="users-agent"
+VERSION="1.2"
+HOMEPAGE="http://www.jabberstudio.org/projects/users-agent/project/view.php"
+DOWNLOAD="http://packages.altlinux.org/en/Platform5/srpms/jabberd2-jud/sources/Users-Agent-1.2.tar.gz/download"
+MD5SUM="e1d580dc34b56d00a1990464659ea766"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="perl-Net-Jabber"
+MAINTAINER="Christopher Walker"
+EMAIL="kris240376@gmail.com"
diff --git a/network/users-agent/users-agent.vcard.patch b/network/users-agent/users-agent.vcard.patch
new file mode 100644
index 000000000000..a33ce7dae914
--- /dev/null
+++ b/network/users-agent/users-agent.vcard.patch
@@ -0,0 +1,135 @@
+--- users-agent 2004-08-07 16:58:45.000000000 -0400
++++ users-agent.vcard 2004-08-07 16:58:59.000000000 -0400
+@@ -214,18 +214,18 @@
+
+ my $fromJID = $iq->GetFrom("jid");
+
+- my $command = "SELECT * FROM jud WHERE jid ='".$fromJID->GetJID()."';";
++ my $command = "SELECT `n-given`,`n-family`,`nickname`,`email` FROM vcard WHERE `collection-owner` ='".$fromJID->GetJID()."';";
+
+ my $sth = $dbh->prepare($command);
+ $sth->execute;
+ my $ref = $sth->fetchrow_hashref();
+ if (defined($ref))
+ {
+- $fields{first} = $ref->{first};
+- $fields{last} = $ref->{last};
+- $fields{nick} = $ref->{nick};
++ $fields{first} = $ref->{'n-given'};
++ $fields{last} = $ref->{'n-family'};
++ $fields{nick} = $ref->{nickname};
+ $fields{email} = $ref->{email};
+- $fields{registered} = 1;
++ $fields{registered} = $ref->{'collection-owner'};
+ }
+ $sth->finish();
+
+@@ -273,8 +273,6 @@
+ my $iqReply = $iq->Reply(type=>"result");
+ my $iqReplyQuery = $iqReply->NewQuery("jabber:iq:register");
+
+- $dbh->do("DELETE FROM jud WHERE jid='".$fromJID->GetJID()."';");
+-
+ my @xData = $query->GetX("jabber:x:data");
+ my %fields;
+ if ($#xData > -1)
+@@ -296,8 +294,20 @@
+ $fields{email} = $query->GetEmail();
+ }
+
+- $dbh->do("INSERT INTO jud VALUES(".$dbh->quote($fromJID->GetJID()).",'',".$dbh->quote($fields{first}).",".$dbh->quote($fields{last}).",".$dbh->quote($fields{nick}).",".$dbh->quote($fields{email}).");");
+-
++ my $rowExists = $dbh->do("SELECT `collection-owner` FROM vcard WHERE `collection-owner` = ".$dbh->quote($fromJID->GetJID()));
++
++ if ( $rowExists == 1)
++ {
++ $dbh->do("UPDATE vcard
++ SET `n-given`=".$dbh->quote($fields{first}).",`n-family`=".$dbh->quote($fields{last}).",nickname=".$dbh->quote($fields{nick}).",email=".$dbh->quote($fields{email}).
++ "WHERE `collection-owner` = ".$dbh->quote($fromJID->GetJID()).";");
++ }
++ else
++ {
++ $dbh->do("INSERT INTO vcard (`collection-owner`,`n-given`,`n-family`,`nickname`,`email`)
++ VALUES (".$dbh->quote($fromJID->GetJID()).",".$dbh->quote($fields{first}).",".$dbh->quote($fields{last}).",".$dbh->quote($fields{nick}).",".$dbh->quote($fields{email}).");");
++ }
++
+ $dbh->do("OPTIMIZE TABLE jud;");
+
+ $Debug->Log1("iqRegisterSetCB: reply(",$iqReply->GetXML(),")");
+@@ -369,20 +379,30 @@
+ {
+ next if ($field->GetValue() eq "");
+ next if ($field->GetVar() eq "speed");
+-
+- push(@commands,$field->GetVar()." LIKE ".$dbh->quote($likeSpeed.$field->GetValue()."%"));
++
++ push(@commands,"`n-given` LIKE ".$dbh->quote($likeSpeed.$field->GetValue()."%"))
++ if ($field->GetVar() eq "first");
++
++ push(@commands,"`n-family` LIKE ".$dbh->quote($likeSpeed.$field->GetValue()."%"))
++ if ($field->GetVar() eq "last");
++
++ push(@commands,"nickname LIKE ".$dbh->quote($likeSpeed.$field->GetValue()."%"))
++ if ($field->GetVar() eq "nick");
++
++ push(@commands,"email LIKE ".$dbh->quote($likeSpeed.$field->GetValue()."%"))
++ if ($field->GetVar() eq "email");
+ }
+ }
+ else
+ {
+
+- push(@commands,"first LIKE ".$dbh->quote("%".$query->GetFirst()."%"))
++ push(@commands,"`n-given` LIKE ".$dbh->quote("%".$query->GetFirst()."%"))
+ if ($query->DefinedFirst() && ($query->GetFirst() ne ""));
+
+- push(@commands,"last LIKE ".$dbh->quote("%".$query->GetLast()."%"))
++ push(@commands,"`n-family` LIKE ".$dbh->quote("%".$query->GetLast()."%"))
+ if ($query->DefinedLast() && ($query->GetLast() ne ""));
+
+- push(@commands,"nick LIKE ".$dbh->quote("%".$query->GetNick()."%"))
++ push(@commands,"nickname LIKE ".$dbh->quote("%".$query->GetNick()."%"))
+ if ($query->DefinedNick() && ($query->GetNick() ne ""));
+
+ push(@commands,"email LIKE ".$dbh->quote("%".$query->GetEmail()."%"))
+@@ -397,7 +417,7 @@
+ }
+ else
+ {
+- my $command = "SELECT * FROM jud WHERE ".join(" AND ",@commands)." order by last";
++ my $command = "SELECT * FROM vcard WHERE ".join(" AND ",@commands)." order by `n-family`";
+ $command .= " limit $config{mysql}->{limit}"
+ if ($config{mysql}->{limit} ne "");
+ $command .= ";";
+@@ -431,23 +451,23 @@
+ {
+ if ($hasForm == 0)
+ {
+- $iqReplyQuery->AddItem(jid=>$ref->{jid},
+- first=>$ref->{first},
+- last=>$ref->{last},
+- nick=>$ref->{nick},
++ $iqReplyQuery->AddItem(jid=>$ref->{'collection-owner'},
++ first=>$ref->{'n-given'},
++ last=>$ref->{'n-family'},
++ nick=>$ref->{nickname},
+ email=>$ref->{email});
+ }
+ else
+ {
+ my $item = $resultsReport->AddItem();
+ $item->AddField(var=>"jid",
+- value=>$ref->{jid});
++ value=>$ref->{'collection-owner'});
+ $item->AddField(var=>"first",
+- value=>$ref->{first});
++ value=>$ref->{'n-given'});
+ $item->AddField(var=>"last",
+- value=>$ref->{last});
++ value=>$ref->{'n-family'});
+ $item->AddField(var=>"nick",
+- value=>$ref->{nick});
++ value=>$ref->{nickname});
+ $item->AddField(var=>"email",
+ value=>$ref->{email});
+ }