diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..e93f9bb
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.4.3.tar.bz2 filter=lfs diff=lfs merge=lfs -text
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1534ba5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.rpm
+*.log
+*spec-20*
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8b4fd68
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+# Makefile for source rpm: cpu
+# $Id: Makefile,v 1.1 2016/02/04 12:17:43 vip-ire Exp $
+NAME := cpu
+SPECFILE = $(firstword $(wildcard *.spec))
+
+define find-makefile-common
+for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
+endef
+
+MAKEFILE_COMMON := $(shell $(find-makefile-common))
+
+ifeq ($(MAKEFILE_COMMON),)
+# attept a checkout
+define checkout-makefile-common
+test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
+endef
+
+MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
+endif
+
+include $(MAKEFILE_COMMON)
diff --git a/README.md b/README.md
index 9da6832..15bca7e 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,11 @@
# cpu
-3rd Party (Maintained by Koozali) git repo for cpu smeserver
\ No newline at end of file
+3rd Party (Maintained by Koozali) git repo for cpu smeserver
+
+## Description
+
+
*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
+*Once it has been checked, then this comment will be deleted*
+
+
+The CPU (Central Processing Unit) is a piece of software that controls the overall operation of a computer system. It is responsible for interpreting and executing instructions from a software program, and for managing the flow of data among components. The CPU can interpret instructions from hardware components, such as memory, input/output devices, and other peripherals. It can also manage the allocation of resources to these components in order to maximize performance and efficiency.
diff --git a/contriborbase b/contriborbase
new file mode 100644
index 0000000..ef36a67
--- /dev/null
+++ b/contriborbase
@@ -0,0 +1 @@
+sme10
diff --git a/cpu-1.4.3-doc_install.patch b/cpu-1.4.3-doc_install.patch
new file mode 100644
index 0000000..86425c7
--- /dev/null
+++ b/cpu-1.4.3-doc_install.patch
@@ -0,0 +1,12 @@
+diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/doc/Makefile.in mezzanine_patched_cpu-1.4.3/doc/Makefile.in
+--- cpu-1.4.3/doc/Makefile.in 2004-01-11 23:52:20.000000000 -0500
++++ mezzanine_patched_cpu-1.4.3/doc/Makefile.in 2006-09-26 13:27:34.000000000 -0400
+@@ -120,7 +120,7 @@
+ program_transform_name = @program_transform_name@
+ sbindir = @sbindir@
+ sharedstatedir = @sharedstatedir@
+-sysconfdir = @sysconfdir@
++sysconfdir = $(DESTDIR)@sysconfdir@
+ target_alias = @target_alias@
+ SUBDIRS = man
+ data_DATA = cpu.conf.doc test.ldif
diff --git a/cpu-1.4.3-empty-attr.patch b/cpu-1.4.3-empty-attr.patch
new file mode 100644
index 0000000..5be8dfa
--- /dev/null
+++ b/cpu-1.4.3-empty-attr.patch
@@ -0,0 +1,15 @@
+diff -up cpu-1.4.3/src/plugins/ldap/ld.c.empty-attr cpu-1.4.3/src/plugins/ldap/ld.c
+--- cpu-1.4.3/src/plugins/ldap/ld.c.empty-attr 2010-11-05 21:18:12.000000000 -0600
++++ cpu-1.4.3/src/plugins/ldap/ld.c 2010-11-05 21:19:48.000000000 -0600
+@@ -282,7 +282,10 @@ ldapBuildListStr (int mod_op, char *mod_
+ {
+ char **temp;
+
+- if (value == NULL)
++ if (mod_type == NULL || strlen(mod_type) == strspn(mod_type, " "))
++ return mods;
++
++ if (value == NULL || strlen(value) == strspn(value, " "))
+ return mods;
+
+ mods = ldapAddList (mods);
diff --git a/cpu-1.4.3-fix-cn.patch b/cpu-1.4.3-fix-cn.patch
new file mode 100644
index 0000000..f7b9538
--- /dev/null
+++ b/cpu-1.4.3-fix-cn.patch
@@ -0,0 +1,26 @@
+diff -up cpu-1.4.3/src/plugins/ldap/ld.c.fix-cn cpu-1.4.3/src/plugins/ldap/ld.c
+--- cpu-1.4.3/src/plugins/ldap/ld.c.fix-cn 2010-11-05 11:36:45.000000000 -0600
++++ cpu-1.4.3/src/plugins/ldap/ld.c 2010-11-05 11:40:11.000000000 -0600
+@@ -437,7 +437,9 @@ ldapGetCn (void)
+ size_t slen = 0;
+ char *temp;
+
+- if (globalLdap->first_name && globalLdap->last_name)
++ if (globalLdap->passent->pw_gecos)
++ temp = globalLdap->passent->pw_gecos;
++ else if (globalLdap->first_name && globalLdap->last_name)
+ {
+ slen =
+ strlen (globalLdap->first_name) + strlen (globalLdap->last_name) + 2;
+diff -up cpu-1.4.3/src/plugins/ldap/user.c.fix-cn cpu-1.4.3/src/plugins/ldap/user.c
+--- cpu-1.4.3/src/plugins/ldap/user.c.fix-cn 2004-01-10 19:12:37.000000000 -0700
++++ cpu-1.4.3/src/plugins/ldap/user.c 2010-11-05 11:46:48.000000000 -0600
+@@ -256,6 +256,8 @@ ldapUserCheck (int mod_op, LDAP * ld)
+ ldapBuildList (op, "objectClass", globalLdap->user_object_class,
+ userMod);
+ }
++ else if (globalLdap->passent->pw_gecos || (globalLdap->first_name && globalLdap->last_name))
++ userMod = ldapBuildListStr (op, "cn", ldapGetCn (), userMod);
+
+ userMod =
+ ldapBuildListStr (op, "uid", globalLdap->passent->pw_name, userMod);
diff --git a/cpu-1.4.3-gid-not-supp.patch b/cpu-1.4.3-gid-not-supp.patch
new file mode 100644
index 0000000..80d1fbd
--- /dev/null
+++ b/cpu-1.4.3-gid-not-supp.patch
@@ -0,0 +1,37 @@
+diff -up cpu-1.4.3/src/plugins/ldap/user.c.gid-not-supp cpu-1.4.3/src/plugins/ldap/user.c
+--- cpu-1.4.3/src/plugins/ldap/user.c.gid-not-supp 2010-11-07 21:51:45.000000000 -0700
++++ cpu-1.4.3/src/plugins/ldap/user.c 2010-11-07 22:01:26.000000000 -0700
+@@ -402,33 +402,6 @@ ldapUserCheck (int mod_op, LDAP * ld)
+ }
+ }
+ }
+- if (globalLdap->gid)
+- {
+- tcn = cfg_get_str ("LDAP", "GROUP_CN_STRING");
+- if (tcn == NULL)
+- tcn = strdup ("cn");
+- strsize = strlen (globalLdap->gid) +
+- strlen (gf) + strlen (tcn) + 8;
+- filter2 = (char *) malloc (sizeof (char) * strsize);
+- if (filter2 == NULL)
+- return -1;
+- bzero (filter2, strsize);
+- snprintf (filter2, strsize, "(&%s (%s=%s))",
+- gf, tcn, globalLdap->gid);
+- if (ldap_search_st
+- (ld, globalLdap->group_base, LDAP_SCOPE_SUBTREE, filter2,
+- attrs, 0, &globalLdap->timeout, res) != LDAP_SUCCESS)
+- {
+- CPU_ldapPerror (ld, globalLdap,
+- "ldapUserCheck: ldap_search_st");
+- return -1;
+- }
+- ldapres = ldap_count_entries (ld, res[0]);
+- if (ldapres > 0)
+- {
+- ldap_modify_s (ld, ldap_get_dn (ld, res[0]), tmod);
+- }
+- }
+ free (gf);
+ }
+ if (globalLdap->first_name)
diff --git a/cpu-1.4.3-md5crypt.patch b/cpu-1.4.3-md5crypt.patch
new file mode 100644
index 0000000..08cc7c3
--- /dev/null
+++ b/cpu-1.4.3-md5crypt.patch
@@ -0,0 +1,75 @@
+diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/src/include/util/hash.h mezzanine_patched_cpu-1.4.3/src/include/util/hash.h
+--- cpu-1.4.3/src/include/util/hash.h 2003-09-26 22:27:01.000000000 -0400
++++ mezzanine_patched_cpu-1.4.3/src/include/util/hash.h 2007-07-24 15:26:10.000000000 -0400
+@@ -49,12 +49,14 @@
+ #define PASSWORD_SIZE 128
+
+ /* hash_t should have a one-to-one correspondence with hashes */
++/* HVB added H_MD5CRYPT */
+ typedef enum {
+ H_SHA1 = 0,
+ H_SSHA1,
+ H_MD5,
+ H_SMD5,
+ H_CRYPT,
++ H_MD5CRYPT,
+ H_CLEAR,
+ H_UNKNOWN,
+ } hash_t;
+diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/src/plugins/ldap/ld.c mezzanine_patched_cpu-1.4.3/src/plugins/ldap/ld.c
+--- cpu-1.4.3/src/plugins/ldap/ld.c 2007-07-24 15:26:53.000000000 -0400
++++ mezzanine_patched_cpu-1.4.3/src/plugins/ldap/ld.c 2007-07-24 15:26:10.000000000 -0400
+@@ -478,6 +478,9 @@
+ case H_CRYPT:
+ return ldap_hashes[H_CRYPT];
+ break;
++ case H_MD5CRYPT: /* HvB */
++ return ldap_hashes[H_CRYPT];
++ break;
+ case H_CLEAR:
+ /* FIXME: this should work so that the prefix is returned for the
+ correct hash but the password doesn't get encrypted */
+diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/src/util/hash.c mezzanine_patched_cpu-1.4.3/src/util/hash.c
+--- cpu-1.4.3/src/util/hash.c 2003-10-22 17:29:19.000000000 -0400
++++ mezzanine_patched_cpu-1.4.3/src/util/hash.c 2007-07-24 15:26:10.000000000 -0400
+@@ -50,6 +50,7 @@
+ "md5",
+ "smd5",
+ "crypt",
++ "md5crypt",
+ "clear",
+ NULL
+ };
+@@ -140,6 +141,11 @@
+ char * passphrase = NULL;
+ size_t plen = 0;
+
++ /*
++ * HvB
++ */
++ char md5salt[32];
++
+ if ( password == NULL )
+ return NULL;
+
+@@ -185,9 +191,20 @@
+ fprintf(stderr, "Your c library is missing 'crypt'\n");
+ #endif
+ break;
++
++ case H_MD5CRYPT: /* HvB */
++#ifdef HAVE_LIBCRYPT
++ snprintf(md5salt, sizeof(md5salt),"$1$%s", cgetSalt());
++ temp = crypt(password, md5salt);
++#else
++ fprintf(stderr, "Your c library is missing 'crypt'\n");
++#endif
++ break;
++
+ case H_CLEAR:
+ temp = password;
+ break;
++
+ default:
+ fprintf(stderr, "getHash: Unknown hash type.\n");
+ return NULL;
diff --git a/cpu-1.4.3-mod-delete.patch b/cpu-1.4.3-mod-delete.patch
new file mode 100644
index 0000000..6b6816c
--- /dev/null
+++ b/cpu-1.4.3-mod-delete.patch
@@ -0,0 +1,249 @@
+diff -up cpu-1.4.3/src/include/plugins/ldap/ldap.h.mod-delete cpu-1.4.3/src/include/plugins/ldap/ldap.h
+--- cpu-1.4.3/src/include/plugins/ldap/ldap.h.mod-delete 2003-12-30 20:22:20.000000000 -0700
++++ cpu-1.4.3/src/include/plugins/ldap/ldap.h 2010-11-05 23:54:19.000000000 -0600
+@@ -127,8 +127,8 @@ int ldapCat(LDAP *ld);
+ uid_t getNextUid(LDAP * ld);
+ gid_t getNextGid(LDAP * ld, ldapop_t op);
+ int ldapUserCheck(int mod_op, LDAP * ld);
+-int ldapGroupCheck(int mod_op);
+-LDAPMod ** ldapBuildListStr(int mod_op, char * mod_type, char * value,
++int ldapGroupCheck(int mod_op, LDAP * ld);
++LDAPMod ** ldapBuildListStr(LDAP * ld, int mod_op, char * mod_type, char * value,
+ LDAPMod ** mods);
+ LDAPMod ** ldapBuildList(int mod_op, char * mod_type, char ** value,
+ LDAPMod ** mods);
+diff -up cpu-1.4.3/src/plugins/ldap/group.c.mod-delete cpu-1.4.3/src/plugins/ldap/group.c
+--- cpu-1.4.3/src/plugins/ldap/group.c.mod-delete 2003-10-12 17:34:59.000000000 -0600
++++ cpu-1.4.3/src/plugins/ldap/group.c 2010-11-05 23:54:19.000000000 -0600
+@@ -31,7 +31,7 @@ LDAPMod **groupMod = NULL;
+ int
+ ldapGroupAdd (LDAP * ld)
+ {
+- if (ldapGroupCheck (LDAP_MOD_ADD) < 0)
++ if (ldapGroupCheck (LDAP_MOD_ADD, ld) < 0)
+ {
+ fprintf (stderr, "ldap: ldapGroupAdd: error in ldapGroupCheck\n");
+ return -1;
+@@ -50,7 +50,7 @@ int
+ ldapGroupMod (LDAP * ld)
+ {
+ char *newdn = NULL;
+- if (ldapGroupCheck (LDAP_MOD_REPLACE) < 0)
++ if (ldapGroupCheck (LDAP_MOD_REPLACE, ld) < 0)
+ {
+ fprintf (stderr, "ldap: ldapGroupMod: error in ldapGroupCheck\n");
+ return -1;
+@@ -105,7 +105,7 @@ ldapGroupDel (LDAP * ld)
+ }
+
+ int
+-ldapGroupCheck (int mod_op)
++ldapGroupCheck (int mod_op, LDAP * ld)
+ {
+ int op = 0;
+ if (mod_op == LDAP_MOD_ADD)
+@@ -126,11 +126,11 @@ ldapGroupCheck (int mod_op)
+ groupMod = ldapBuildList (op, "objectClass",
+ globalLdap->group_object_class, groupMod);
+ groupMod =
+- ldapBuildListStr (LDAP_MOD_ADD, "cn", ldapGetCn (), groupMod);
++ ldapBuildListStr (ld, LDAP_MOD_ADD, "cn", ldapGetCn (), groupMod);
+ }
+
+ if (globalLdap->passent->pw_passwd)
+- groupMod = ldapBuildListStr (op, "userPassword",
++ groupMod = ldapBuildListStr (ld, op, "userPassword",
+ globalLdap->passent->pw_passwd, groupMod);
+
+ if ((int) globalLdap->passent->pw_gid > -1)
+@@ -143,7 +143,7 @@ ldapGroupCheck (int mod_op)
+ pos = globalLdap->parse;
+ while (pos != NULL)
+ {
+- groupMod = ldapBuildListStr (op, pos->attr, pos->attrval, groupMod);
++ groupMod = ldapBuildListStr (ld, op, pos->attr, pos->attrval, groupMod);
+ pos = pos->next;
+ }
+ }
+diff -up cpu-1.4.3/src/plugins/ldap/ld.c.mod-delete cpu-1.4.3/src/plugins/ldap/ld.c
+--- cpu-1.4.3/src/plugins/ldap/ld.c.mod-delete 2010-11-05 23:53:41.000000000 -0600
++++ cpu-1.4.3/src/plugins/ldap/ld.c 2010-11-06 00:03:17.000000000 -0600
+@@ -278,7 +278,7 @@ ldapAddList (LDAPMod ** mods)
+ }
+
+ LDAPMod **
+-ldapBuildListStr (int mod_op, char *mod_type, char *value, LDAPMod ** mods)
++ldapBuildListStr (LDAP * ld, int mod_op, char *mod_type, char *value, LDAPMod ** mods)
+ {
+ char **temp;
+
+@@ -286,19 +286,66 @@ ldapBuildListStr (int mod_op, char *mod_
+ return mods;
+
+ if (value == NULL || strlen(value) == strspn(value, " "))
+- return mods;
+-
+- mods = ldapAddList (mods);
++ {
++ int strsize = 1;
++ char *filter = NULL;
++ int ldapres = 0;
++ int err = 0;
++
++ LDAPMessage *res[2];
++ res[1] = NULL;
++
++ strsize = strlen (mod_type) + 5;
++ filter = (char *) malloc (sizeof (char) * strsize);
++ if (filter == NULL)
++ return -1;
++ bzero (filter, strsize);
++ snprintf (filter, strsize, "(%s=*)", mod_type);
++ if (ldap_search_st (ld, globalLdap->dn, LDAP_SCOPE_BASE, filter, NULL, 0,
++ &globalLdap->timeout, res) != LDAP_SUCCESS)
++ {
++ if (ldap_get_option (ld, LDAP_OPT_ERROR_NUMBER, &err) < 0)
++ {
++ fprintf (stderr, "Error in ldap_get_option\n");
++ return -1;
++ }
++ if (err != LDAP_NO_SUCH_OBJECT)
++ {
++ CPU_ldapPerror (ld, globalLdap,
++ "ldapBuildListStr: ldap_search_st");
++ return -1;
++ }
++ }
++ else
++ {
++ ldapres = ldap_count_entries (ld, res[0]);
++ if (ldapres > 0)
++ {
++ mods = ldapAddList (mods);
++
++ mods[list_size]->mod_op = LDAP_MOD_DELETE;
++ mods[list_size]->mod_type = strdup (mod_type);
++ mods[list_size]->mod_values = NULL;
++ list_size++;
++ }
++ }
++ free(filter);
++ }
++ else
++ {
++ mods = ldapAddList (mods);
+
+- temp = (char **) malloc (sizeof (char *) * 2);
+- bzero (temp, sizeof (char *) * 2);
+- temp[0] = value;
+- temp[1] = NULL;
++ temp = (char **) malloc (sizeof (char *) * 2);
++ bzero (temp, sizeof (char *) * 2);
++ temp[0] = value;
++ temp[1] = NULL;
++
++ mods[list_size]->mod_op = mod_op;
++ mods[list_size]->mod_type = strdup (mod_type);
++ mods[list_size]->mod_values = temp;
++ list_size++;
++ }
+
+- mods[list_size]->mod_op = mod_op;
+- mods[list_size]->mod_type = strdup (mod_type);
+- mods[list_size]->mod_values = temp;
+- list_size++;
+ return mods;
+ }
+
+diff -up cpu-1.4.3/src/plugins/ldap/user.c.mod-delete cpu-1.4.3/src/plugins/ldap/user.c
+--- cpu-1.4.3/src/plugins/ldap/user.c.mod-delete 2010-11-05 23:53:41.000000000 -0600
++++ cpu-1.4.3/src/plugins/ldap/user.c 2010-11-05 23:54:19.000000000 -0600
+@@ -251,16 +251,16 @@ ldapUserCheck (int mod_op, LDAP * ld)
+ */
+ if (op == LDAP_MOD_ADD)
+ {
+- userMod = ldapBuildListStr (LDAP_MOD_ADD, "cn", ldapGetCn (), userMod);
++ userMod = ldapBuildListStr (ld, LDAP_MOD_ADD, "cn", ldapGetCn (), userMod);
+ userMod =
+ ldapBuildList (op, "objectClass", globalLdap->user_object_class,
+ userMod);
+ }
+ else if (globalLdap->passent->pw_gecos || (globalLdap->first_name && globalLdap->last_name))
+- userMod = ldapBuildListStr (op, "cn", ldapGetCn (), userMod);
++ userMod = ldapBuildListStr (ld, op, "cn", ldapGetCn (), userMod);
+
+ userMod =
+- ldapBuildListStr (op, "uid", globalLdap->passent->pw_name, userMod);
++ ldapBuildListStr (ld, op, "uid", globalLdap->passent->pw_name, userMod);
+
+ /* do we allow duplicates ? */
+ if ((int) globalLdap->passent->pw_uid > -1)
+@@ -433,35 +433,35 @@ ldapUserCheck (int mod_op, LDAP * ld)
+ }
+ if (globalLdap->first_name)
+ userMod =
+- ldapBuildListStr (op, "givenName", globalLdap->first_name, userMod);
++ ldapBuildListStr (ld, op, "givenName", globalLdap->first_name, userMod);
+
+ if (globalLdap->last_name)
+- userMod = ldapBuildListStr (op, "sn", globalLdap->last_name, userMod);
++ userMod = ldapBuildListStr (ld, op, "sn", globalLdap->last_name, userMod);
+
+ if (globalLdap->new_username)
+- userMod = ldapBuildListStr (op, "uid", globalLdap->new_username, userMod);
++ userMod = ldapBuildListStr (ld, op, "uid", globalLdap->new_username, userMod);
+
+ if (globalLdap->email_address)
+ userMod =
+- ldapBuildListStr (op, "mail", globalLdap->email_address, userMod);
++ ldapBuildListStr (ld, op, "mail", globalLdap->email_address, userMod);
+
+ if (globalLdap->passent->pw_passwd)
+ userMod =
+- ldapBuildListStr (op, "userPassword", globalLdap->passent->pw_passwd,
++ ldapBuildListStr (ld, op, "userPassword", globalLdap->passent->pw_passwd,
+ userMod);
+
+ if (globalLdap->passent->pw_gecos)
+- userMod = ldapBuildListStr (op, "gecos", globalLdap->passent->pw_gecos,
++ userMod = ldapBuildListStr (ld, op, "gecos", globalLdap->passent->pw_gecos,
+ userMod);
+
+ if (globalLdap->passent->pw_dir)
+ userMod =
+- ldapBuildListStr (op, "homeDirectory", globalLdap->passent->pw_dir,
++ ldapBuildListStr (ld, op, "homeDirectory", globalLdap->passent->pw_dir,
+ userMod);
+
+ if (globalLdap->passent->pw_shell)
+ userMod =
+- ldapBuildListStr (op, "loginShell", globalLdap->passent->pw_shell,
++ ldapBuildListStr (ld, op, "loginShell", globalLdap->passent->pw_shell,
+ userMod);
+ if ((int) globalLdap->passent->sp_lstchg != -10)
+ userMod = ldapBuildListInt (op, "shadowLastChange",
+@@ -501,7 +501,7 @@ ldapUserCheck (int mod_op, LDAP * ld)
+ pos = globalLdap->parse;
+ while (pos != NULL)
+ {
+- userMod = ldapBuildListStr (op, pos->attr, pos->attrval, userMod);
++ userMod = ldapBuildListStr (ld, op, pos->attr, pos->attrval, userMod);
+ pos = pos->next;
+ }
+ }
+diff -up cpu-1.4.3/src/util/parser.c.mod-delete cpu-1.4.3/src/util/parser.c
+--- cpu-1.4.3/src/util/parser.c.mod-delete 2010-11-07 16:05:19.000000000 -0700
++++ cpu-1.4.3/src/util/parser.c 2010-11-07 16:13:07.000000000 -0700
+@@ -290,11 +290,7 @@
+ p->cont = true;
+ token = getToken(&cart[i], delim);
+ if ( token == NULL )
+- {
+- printf("%d: Malformed file, cannot continue parsing.\n",
+- __LINE__);
+- return NULL;
+- }
++ token = strdup ("");
+ }
+ p->attrval = delWhite(&token);
+ pos = parse;
diff --git a/cpu-1.4.3-read.patch b/cpu-1.4.3-read.patch
new file mode 100644
index 0000000..4500b53
--- /dev/null
+++ b/cpu-1.4.3-read.patch
@@ -0,0 +1,51 @@
+diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/src/util/parser.c mezzanine_patched_cpu-1.4.3/src/util/parser.c
+--- cpu-1.4.3/src/util/parser.c 2003-10-22 17:17:15.000000000 -0400
++++ mezzanine_patched_cpu-1.4.3/src/util/parser.c 2007-07-24 15:17:47.000000000 -0400
+@@ -57,6 +57,8 @@
+ {
+ int fd = 0;
+ ssize_t retval = 0;
++ ssize_t nread;
++ ssize_t bufsize;
+ void * temp;
+ struct stat buf;
+
+@@ -75,14 +77,31 @@
+ return NULL;
+ }
+
+- temp = malloc(buf.st_size);
+- if ( temp == NULL )
+- return NULL;
+- bzero(temp, buf.st_size);
+-
+- retval = read(fd, temp, buf.st_size);
++ for (nread = 0, temp = NULL, bufsize = 4096; ;bufsize *= 2)
++ {
++ void *temp2;
++ ssize_t rbufsize;
++ temp2 = malloc(bufsize);
++ if ( temp2 == NULL )
++ {
++ perror(filename);
++ return NULL;
++ }
++ bzero(temp2, bufsize);
++ if (temp)
++ {
++ memcpy(temp2, temp, nread);
++ free(temp);
++ }
++ temp = temp2;
++ rbufsize = bufsize - nread;
++ retval = read(fd, temp+nread, rbufsize);
++ nread += retval;
++ if (retval < rbufsize)
++ break;
++ }
+ close(fd);
+- if ( retval != buf.st_size )
++ if (buf.st_size && nread != buf.st_size )
+ printf("Hmm, didn't read all wanted data. Continuing\n");
+ if ( retval < 0 )
+ return NULL;
diff --git a/cpu-1.4.3-rhel5.patch b/cpu-1.4.3-rhel5.patch
new file mode 100644
index 0000000..9f0d6e3
--- /dev/null
+++ b/cpu-1.4.3-rhel5.patch
@@ -0,0 +1,35 @@
+diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/src/plugins/ldap/commandline.c mezzanine_patched_cpu-1.4.3/src/plugins/ldap/commandline.c
+--- cpu-1.4.3/src/plugins/ldap/commandline.c 2004-01-12 00:31:02.000000000 -0500
++++ mezzanine_patched_cpu-1.4.3/src/plugins/ldap/commandline.c 2007-07-24 14:55:44.000000000 -0400
+@@ -83,7 +83,7 @@
+ if (passent == NULL)
+ return -1;
+ bzero (passent, sizeof (struct cpass));
+- (int) passent->sp_lstchg = passent->sp_min = passent->sp_max = -10;
++ passent->sp_lstchg = (int)(passent->sp_min = passent->sp_max = -10);
+ passent->sp_warn = passent->sp_inact = passent->sp_expire = -10;
+ passent->sp_flag = -10;
+ passent->pw_gid = -10;
+diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/src/plugins/ldap/ld.c mezzanine_patched_cpu-1.4.3/src/plugins/ldap/ld.c
+--- cpu-1.4.3/src/plugins/ldap/ld.c 2004-01-11 23:47:37.000000000 -0500
++++ mezzanine_patched_cpu-1.4.3/src/plugins/ldap/ld.c 2007-07-24 14:56:36.000000000 -0400
+@@ -803,11 +803,14 @@
+ return -10;
+ if (gid != NULL)
+ {
+- gid = ldap_get_values (ld, pos, gid)[0];
+- if (gid != NULL)
+- return atoi (gid);
+- else
+- return -10;
++ char **gidval = ldap_get_values (ld, pos, gid);
++ int val;
++
++ if (gidval == NULL)
++ return -10;
++ val = atoi (*gidval);
++ ldap_value_free (gidval);
++ return val;
+ }
+ else
+ return -10;
diff --git a/cpu-1.4.3-rhel6.patch b/cpu-1.4.3-rhel6.patch
new file mode 100644
index 0000000..869d26c
--- /dev/null
+++ b/cpu-1.4.3-rhel6.patch
@@ -0,0 +1,12 @@
+diff -up cpu-1.4.3/src/util/fileaction.c.rhel6 cpu-1.4.3/src/util/fileaction.c
+--- cpu-1.4.3/src/util/fileaction.c.rhel6 2003-02-17 16:25:37.000000000 -0700
++++ cpu-1.4.3/src/util/fileaction.c 2013-02-01 16:09:46.762978006 -0700
+@@ -197,7 +197,7 @@ copy (char * directory, char * newdirect
+ }
+ close (fd1);
+
+- if ((fd2 = open (homefile, O_CREAT | O_EXCL | O_WRONLY)) == -1)
++ if ((fd2 = open (homefile, O_CREAT | O_EXCL | O_WRONLY, S_IRWXU)) == -1)
+ {
+ perror ("open");
+ free (data);
diff --git a/cpu-1.4.3-supp-groups.patch b/cpu-1.4.3-supp-groups.patch
new file mode 100644
index 0000000..cc6ca64
--- /dev/null
+++ b/cpu-1.4.3-supp-groups.patch
@@ -0,0 +1,115 @@
+diff -up cpu-1.4.3/src/plugins/ldap/ld.c.supp-groups cpu-1.4.3/src/plugins/ldap/ld.c
+--- cpu-1.4.3/src/plugins/ldap/ld.c.supp-groups 2010-11-07 19:00:21.000000000 -0700
++++ cpu-1.4.3/src/plugins/ldap/ld.c 2010-11-07 18:56:18.000000000 -0700
+@@ -29,6 +29,7 @@
+
+ gid_t getlGid (LDAP * ld, char *groupn);
+ char *checkSupGroups (LDAP * ld);
++void getSupGroups (LDAP * ld, char *uname);
+ void rmUsrFrmOldSupGrp (LDAP * ld, char *uname);
+ int checkIsPrimaryGroup (LDAP * ld);
+ int groupExists (LDAP * ld, int cgid);
+@@ -193,6 +194,7 @@ ldapOperation (ldapop_t optype)
+ return -1;
+ }
+ }
++ getSupGroups (ld, globalLdap->passent->pw_name);
+ tstr = NULL;
+ if ((tstr = checkSupGroups (ld)) != NULL)
+ {
+@@ -755,6 +757,65 @@ checkSupGroups (LDAP * ld)
+ return NULL;
+ }
+
++void
++getSupGroups (LDAP * ld, char *uname)
++{
++ LDAPMessage *res[2];
++ LDAPMessage *pos;
++ int filtsize = 0;
++ struct timeval timeout;
++ char **vals;
++ char *filter = NULL;
++ char *temp;
++ int num_tokens = 0;
++ char *attrs[7] = {
++ "cn",
++ NULL
++ };
++
++ if (globalLdap->memberUid != NULL)
++ return;
++
++ timeout = globalLdap->timeout;
++ res[1] = NULL;
++
++ temp = cfg_get_str ("LDAP", "GROUP_FILTER");
++ if (temp == NULL)
++ temp = strdup ("(objectClass=PosixGroup)");
++ filtsize = strlen (temp) + strlen (uname) + 18;
++ filter = (char *) malloc (sizeof (char) * filtsize);
++ bzero (filter, filtsize);
++
++ snprintf (filter, filtsize, "(&%s (memberUid=%s))", temp, uname);
++ if (ldap_search_st (ld, globalLdap->group_base, LDAP_SCOPE_SUBTREE,
++ filter, attrs, 0, &timeout, res) != LDAP_SUCCESS)
++ {
++ Free (filter);
++ CPU_ldapPerror (ld, globalLdap, "getSupGroups: ldap_search_st");
++ return;
++ }
++ free (filter);
++ if (ldap_count_entries (ld, res[0]) < 1)
++ return;
++
++ for (pos = ldap_first_entry (ld, res[0]); pos != NULL;
++ pos = ldap_next_entry (ld, pos))
++ {
++ if ((vals = ldap_get_values (ld, pos, "cn")) != NULL)
++ {
++ if (vals[0] != NULL)
++ {
++ globalLdap->memberUid = (char **)
++ realloc (globalLdap->memberUid,
++ sizeof(char*)*((num_tokens+1)*4));
++ globalLdap->memberUid[num_tokens] = strdup(vals[0]);
++ num_tokens++;
++ }
++ }
++ }
++ globalLdap->memberUid[num_tokens] = NULL;
++}
++
+ int
+ groupExists (LDAP * ld, int cgid)
+ {
+diff -up cpu-1.4.3/src/plugins/ldap/commandline.c.supp-groups cpu-1.4.3/src/plugins/ldap/commandline.c
+--- cpu-1.4.3/src/plugins/ldap/commandline.c.supp-groups 2010-11-07 20:45:35.000000000 -0700
++++ cpu-1.4.3/src/plugins/ldap/commandline.c 2010-11-07 20:45:20.000000000 -0700
+@@ -175,15 +175,20 @@
+ if (isalnum ((int)optarg[0]))
+ gtemp = strdup (optarg);
+ if (gtemp == NULL)
+- return -1;
+- while (gtemp != NULL && *gtemp)
+- {
++ {
+ globalLdap->memberUid =
+ (char **) realloc (globalLdap->memberUid,
+ sizeof(char*)*((num_tokens+1)*4));
+- globalLdap->memberUid[num_tokens] = getToken(>emp,",");
+- num_tokens++;
+- }
++ }
++ else
++ while (gtemp != NULL && *gtemp)
++ {
++ globalLdap->memberUid =
++ (char **) realloc (globalLdap->memberUid,
++ sizeof(char*)*((num_tokens+1)*4));
++ globalLdap->memberUid[num_tokens] = getToken(>emp,",");
++ num_tokens++;
++ }
+ globalLdap->memberUid[num_tokens] = NULL;
+ break;
+ }
diff --git a/cpu-1.4.3.tar.bz2 b/cpu-1.4.3.tar.bz2
new file mode 100644
index 0000000..8f2d8c1
--- /dev/null
+++ b/cpu-1.4.3.tar.bz2
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ea958f8086fe08df69b884fd49d3d172d3934b9b3d5fd1bd526294b7927b3478
+size 255668
diff --git a/cpu.spec b/cpu.spec
new file mode 100644
index 0000000..861826c
--- /dev/null
+++ b/cpu.spec
@@ -0,0 +1,115 @@
+# $Id: cpu.spec,v 1.1 2016/02/04 12:17:43 vip-ire Exp $
+
+Summary: Pluggable utility to administer authentication data
+Name: cpu
+Version: 1.4.3
+Release: 14%{?dist}
+License: GPL
+Group: System Environment/Base
+Source: cpu-1.4.3.tar.bz2
+Patch0: cpu-1.4.3-doc_install.patch
+Patch1: cpu-1.4.3-rhel5.patch
+Patch2: cpu-1.4.3-md5crypt.patch
+Patch3: cpu-1.4.3-read.patch
+Patch4: cpu-1.4.3-fix-cn.patch
+Patch5: cpu-1.4.3-empty-attr.patch
+Patch6: cpu-1.4.3-mod-delete.patch
+Patch7: cpu-1.4.3-supp-groups.patch
+Patch8: cpu-1.4.3-gid-not-supp.patch
+Patch9: cpu-1.4.3-rhel6.patch
+Prefix: %{_prefix}
+BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
+BuildRequires: openldap-devel
+
+%description
+CPU is a utility consisting of a set of plugins that allow an administrator to
+administer a wide range of different authentication backends. Current plugins
+include support for LDAP and a partially completed flat file plugin.
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+
+%build
+CFLAGS="%{?cflags:%{cflags}}%{!?cflags:$RPM_OPT_FLAGS}"
+CXXFLAGS="%{?cxxflags:%{cxxflags}}%{!?cflags:$RPM_OPT_FLAGS}"
+export CFLAGS CXXFLAGS
+
+%configure %{?acflags}
+%{__make} %{?mflags}
+
+%install
+%{__make} install DESTDIR=$RPM_BUILD_ROOT %{?mflags_install}
+rm $RPM_BUILD_ROOT/usr/share/cpu.conf.doc
+rm $RPM_BUILD_ROOT/usr/share/test.ldif
+
+%clean
+test "x$RPM_BUILD_ROOT" != "x/" && rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-, root, root)
+%doc README INSTALL COPYING TODO AUTHORS NEWS ChangeLog doc
+%config %attr(0600, root,root) /etc/cpu.conf
+%{_libdir}/*
+/usr/sbin/cpu
+%doc /usr/share/man/man5/*
+%doc /usr/share/man/man8/*
+
+%changelog
+* Wed Jul 12 2023 BogusDateBot
+- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
+ by assuming the date is correct and changing the weekday.
+
+* Fri Feb 1 2013 Shad L. Lords 1.4.3-14.sme
+- Param fix so build on rhel6 works [SME: 7271]
+
+* Sun Nov 7 2010 Shad L. Lords 1.4.3-13.sme
+- user gid shouldn't be part of supplemental groups [SME: 6353]
+
+* Sun Nov 7 2010 Shad L. Lords 1.4.3-12.sme
+- Retrieve supplimential groups if not specified [SME: 6347]
+- Fix memory leak introduced in revision 9 [SME: 6342]
+
+* Sun Nov 7 2010 Shad L. Lords 1.4.3-11.sme
+- Treat null attribs in extra file like empty string [SME: 6342]
+
+* Sat Nov 6 2010 Shad L. Lords 1.4.3-10.sme
+- Object might not exist yet which isn't an error [SME: 6342]
+
+* Fri Nov 5 2010 Shad L. Lords 1.4.3-9.sme
+- Check for attribute before deleting [SME: 6342]
+
+* Fri Nov 5 2010 Shad L. Lords 1.4.3-8.sme
+- If empty value is passed in assume that means delete [SME: 6342]
+
+* Fri Nov 5 2010 Shad L. Lords 1.4.3-7.sme
+- Ignore attributes that have empty attr [SME: 6341]
+
+* Fri Nov 5 2010 Shad L. Lords 1.4.3-6.sme
+- Use gecos for cn if available, also modify cn if possible [SME: 6338]
+
+* Fri Aug 03 2007 Charlie Brady 1.4.3-5.sme
+- Read LDIF files until eof, rather than use stat size. Allows
+ read from, e.g. /dev/stdin.
+
+* Fri Aug 03 2007 Charlie Brady 1.4.3-4.sme
+- Add md5crypt support (from sourceforge).
+
+* Tue Jul 24 2007 Charlie Brady 1.4.3-3.sme
+- Portability fixes to allow building on RHEL5/CentOS5.
+
+* Wed Sep 27 2006 Charlie Brady 1.4.3-2.sme
+- Update file list, and remove world read from cpu.conf.
+
+* Tue Sep 26 2006 Charlie Brady
+- Initial
+