/[smeserver]/rpms/cpu/sme10/cpu-1.4.3-mod-delete.patch
ViewVC logotype

Annotation of /rpms/cpu/sme10/cpu-1.4.3-mod-delete.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Feb 4 12:17:43 2016 UTC (8 years, 9 months ago) by vip-ire
Branch: MAIN
CVS Tags: cpu-1_4_3-14_el7_sme, HEAD
sme10 branch

1 vip-ire 1.1 diff -up cpu-1.4.3/src/include/plugins/ldap/ldap.h.mod-delete cpu-1.4.3/src/include/plugins/ldap/ldap.h
2     --- cpu-1.4.3/src/include/plugins/ldap/ldap.h.mod-delete 2003-12-30 20:22:20.000000000 -0700
3     +++ cpu-1.4.3/src/include/plugins/ldap/ldap.h 2010-11-05 23:54:19.000000000 -0600
4     @@ -127,8 +127,8 @@ int ldapCat(LDAP *ld);
5     uid_t getNextUid(LDAP * ld);
6     gid_t getNextGid(LDAP * ld, ldapop_t op);
7     int ldapUserCheck(int mod_op, LDAP * ld);
8     -int ldapGroupCheck(int mod_op);
9     -LDAPMod ** ldapBuildListStr(int mod_op, char * mod_type, char * value,
10     +int ldapGroupCheck(int mod_op, LDAP * ld);
11     +LDAPMod ** ldapBuildListStr(LDAP * ld, int mod_op, char * mod_type, char * value,
12     LDAPMod ** mods);
13     LDAPMod ** ldapBuildList(int mod_op, char * mod_type, char ** value,
14     LDAPMod ** mods);
15     diff -up cpu-1.4.3/src/plugins/ldap/group.c.mod-delete cpu-1.4.3/src/plugins/ldap/group.c
16     --- cpu-1.4.3/src/plugins/ldap/group.c.mod-delete 2003-10-12 17:34:59.000000000 -0600
17     +++ cpu-1.4.3/src/plugins/ldap/group.c 2010-11-05 23:54:19.000000000 -0600
18     @@ -31,7 +31,7 @@ LDAPMod **groupMod = NULL;
19     int
20     ldapGroupAdd (LDAP * ld)
21     {
22     - if (ldapGroupCheck (LDAP_MOD_ADD) < 0)
23     + if (ldapGroupCheck (LDAP_MOD_ADD, ld) < 0)
24     {
25     fprintf (stderr, "ldap: ldapGroupAdd: error in ldapGroupCheck\n");
26     return -1;
27     @@ -50,7 +50,7 @@ int
28     ldapGroupMod (LDAP * ld)
29     {
30     char *newdn = NULL;
31     - if (ldapGroupCheck (LDAP_MOD_REPLACE) < 0)
32     + if (ldapGroupCheck (LDAP_MOD_REPLACE, ld) < 0)
33     {
34     fprintf (stderr, "ldap: ldapGroupMod: error in ldapGroupCheck\n");
35     return -1;
36     @@ -105,7 +105,7 @@ ldapGroupDel (LDAP * ld)
37     }
38    
39     int
40     -ldapGroupCheck (int mod_op)
41     +ldapGroupCheck (int mod_op, LDAP * ld)
42     {
43     int op = 0;
44     if (mod_op == LDAP_MOD_ADD)
45     @@ -126,11 +126,11 @@ ldapGroupCheck (int mod_op)
46     groupMod = ldapBuildList (op, "objectClass",
47     globalLdap->group_object_class, groupMod);
48     groupMod =
49     - ldapBuildListStr (LDAP_MOD_ADD, "cn", ldapGetCn (), groupMod);
50     + ldapBuildListStr (ld, LDAP_MOD_ADD, "cn", ldapGetCn (), groupMod);
51     }
52    
53     if (globalLdap->passent->pw_passwd)
54     - groupMod = ldapBuildListStr (op, "userPassword",
55     + groupMod = ldapBuildListStr (ld, op, "userPassword",
56     globalLdap->passent->pw_passwd, groupMod);
57    
58     if ((int) globalLdap->passent->pw_gid > -1)
59     @@ -143,7 +143,7 @@ ldapGroupCheck (int mod_op)
60     pos = globalLdap->parse;
61     while (pos != NULL)
62     {
63     - groupMod = ldapBuildListStr (op, pos->attr, pos->attrval, groupMod);
64     + groupMod = ldapBuildListStr (ld, op, pos->attr, pos->attrval, groupMod);
65     pos = pos->next;
66     }
67     }
68     diff -up cpu-1.4.3/src/plugins/ldap/ld.c.mod-delete cpu-1.4.3/src/plugins/ldap/ld.c
69     --- cpu-1.4.3/src/plugins/ldap/ld.c.mod-delete 2010-11-05 23:53:41.000000000 -0600
70     +++ cpu-1.4.3/src/plugins/ldap/ld.c 2010-11-06 00:03:17.000000000 -0600
71     @@ -278,7 +278,7 @@ ldapAddList (LDAPMod ** mods)
72     }
73    
74     LDAPMod **
75     -ldapBuildListStr (int mod_op, char *mod_type, char *value, LDAPMod ** mods)
76     +ldapBuildListStr (LDAP * ld, int mod_op, char *mod_type, char *value, LDAPMod ** mods)
77     {
78     char **temp;
79    
80     @@ -286,19 +286,66 @@ ldapBuildListStr (int mod_op, char *mod_
81     return mods;
82    
83     if (value == NULL || strlen(value) == strspn(value, " "))
84     - return mods;
85     -
86     - mods = ldapAddList (mods);
87     + {
88     + int strsize = 1;
89     + char *filter = NULL;
90     + int ldapres = 0;
91     + int err = 0;
92     +
93     + LDAPMessage *res[2];
94     + res[1] = NULL;
95     +
96     + strsize = strlen (mod_type) + 5;
97     + filter = (char *) malloc (sizeof (char) * strsize);
98     + if (filter == NULL)
99     + return -1;
100     + bzero (filter, strsize);
101     + snprintf (filter, strsize, "(%s=*)", mod_type);
102     + if (ldap_search_st (ld, globalLdap->dn, LDAP_SCOPE_BASE, filter, NULL, 0,
103     + &globalLdap->timeout, res) != LDAP_SUCCESS)
104     + {
105     + if (ldap_get_option (ld, LDAP_OPT_ERROR_NUMBER, &err) < 0)
106     + {
107     + fprintf (stderr, "Error in ldap_get_option\n");
108     + return -1;
109     + }
110     + if (err != LDAP_NO_SUCH_OBJECT)
111     + {
112     + CPU_ldapPerror (ld, globalLdap,
113     + "ldapBuildListStr: ldap_search_st");
114     + return -1;
115     + }
116     + }
117     + else
118     + {
119     + ldapres = ldap_count_entries (ld, res[0]);
120     + if (ldapres > 0)
121     + {
122     + mods = ldapAddList (mods);
123     +
124     + mods[list_size]->mod_op = LDAP_MOD_DELETE;
125     + mods[list_size]->mod_type = strdup (mod_type);
126     + mods[list_size]->mod_values = NULL;
127     + list_size++;
128     + }
129     + }
130     + free(filter);
131     + }
132     + else
133     + {
134     + mods = ldapAddList (mods);
135    
136     - temp = (char **) malloc (sizeof (char *) * 2);
137     - bzero (temp, sizeof (char *) * 2);
138     - temp[0] = value;
139     - temp[1] = NULL;
140     + temp = (char **) malloc (sizeof (char *) * 2);
141     + bzero (temp, sizeof (char *) * 2);
142     + temp[0] = value;
143     + temp[1] = NULL;
144     +
145     + mods[list_size]->mod_op = mod_op;
146     + mods[list_size]->mod_type = strdup (mod_type);
147     + mods[list_size]->mod_values = temp;
148     + list_size++;
149     + }
150    
151     - mods[list_size]->mod_op = mod_op;
152     - mods[list_size]->mod_type = strdup (mod_type);
153     - mods[list_size]->mod_values = temp;
154     - list_size++;
155     return mods;
156     }
157    
158     diff -up cpu-1.4.3/src/plugins/ldap/user.c.mod-delete cpu-1.4.3/src/plugins/ldap/user.c
159     --- cpu-1.4.3/src/plugins/ldap/user.c.mod-delete 2010-11-05 23:53:41.000000000 -0600
160     +++ cpu-1.4.3/src/plugins/ldap/user.c 2010-11-05 23:54:19.000000000 -0600
161     @@ -251,16 +251,16 @@ ldapUserCheck (int mod_op, LDAP * ld)
162     */
163     if (op == LDAP_MOD_ADD)
164     {
165     - userMod = ldapBuildListStr (LDAP_MOD_ADD, "cn", ldapGetCn (), userMod);
166     + userMod = ldapBuildListStr (ld, LDAP_MOD_ADD, "cn", ldapGetCn (), userMod);
167     userMod =
168     ldapBuildList (op, "objectClass", globalLdap->user_object_class,
169     userMod);
170     }
171     else if (globalLdap->passent->pw_gecos || (globalLdap->first_name && globalLdap->last_name))
172     - userMod = ldapBuildListStr (op, "cn", ldapGetCn (), userMod);
173     + userMod = ldapBuildListStr (ld, op, "cn", ldapGetCn (), userMod);
174    
175     userMod =
176     - ldapBuildListStr (op, "uid", globalLdap->passent->pw_name, userMod);
177     + ldapBuildListStr (ld, op, "uid", globalLdap->passent->pw_name, userMod);
178    
179     /* do we allow duplicates ? */
180     if ((int) globalLdap->passent->pw_uid > -1)
181     @@ -433,35 +433,35 @@ ldapUserCheck (int mod_op, LDAP * ld)
182     }
183     if (globalLdap->first_name)
184     userMod =
185     - ldapBuildListStr (op, "givenName", globalLdap->first_name, userMod);
186     + ldapBuildListStr (ld, op, "givenName", globalLdap->first_name, userMod);
187    
188     if (globalLdap->last_name)
189     - userMod = ldapBuildListStr (op, "sn", globalLdap->last_name, userMod);
190     + userMod = ldapBuildListStr (ld, op, "sn", globalLdap->last_name, userMod);
191    
192     if (globalLdap->new_username)
193     - userMod = ldapBuildListStr (op, "uid", globalLdap->new_username, userMod);
194     + userMod = ldapBuildListStr (ld, op, "uid", globalLdap->new_username, userMod);
195    
196     if (globalLdap->email_address)
197     userMod =
198     - ldapBuildListStr (op, "mail", globalLdap->email_address, userMod);
199     + ldapBuildListStr (ld, op, "mail", globalLdap->email_address, userMod);
200    
201     if (globalLdap->passent->pw_passwd)
202     userMod =
203     - ldapBuildListStr (op, "userPassword", globalLdap->passent->pw_passwd,
204     + ldapBuildListStr (ld, op, "userPassword", globalLdap->passent->pw_passwd,
205     userMod);
206    
207     if (globalLdap->passent->pw_gecos)
208     - userMod = ldapBuildListStr (op, "gecos", globalLdap->passent->pw_gecos,
209     + userMod = ldapBuildListStr (ld, op, "gecos", globalLdap->passent->pw_gecos,
210     userMod);
211    
212     if (globalLdap->passent->pw_dir)
213     userMod =
214     - ldapBuildListStr (op, "homeDirectory", globalLdap->passent->pw_dir,
215     + ldapBuildListStr (ld, op, "homeDirectory", globalLdap->passent->pw_dir,
216     userMod);
217    
218     if (globalLdap->passent->pw_shell)
219     userMod =
220     - ldapBuildListStr (op, "loginShell", globalLdap->passent->pw_shell,
221     + ldapBuildListStr (ld, op, "loginShell", globalLdap->passent->pw_shell,
222     userMod);
223     if ((int) globalLdap->passent->sp_lstchg != -10)
224     userMod = ldapBuildListInt (op, "shadowLastChange",
225     @@ -501,7 +501,7 @@ ldapUserCheck (int mod_op, LDAP * ld)
226     pos = globalLdap->parse;
227     while (pos != NULL)
228     {
229     - userMod = ldapBuildListStr (op, pos->attr, pos->attrval, userMod);
230     + userMod = ldapBuildListStr (ld, op, pos->attr, pos->attrval, userMod);
231     pos = pos->next;
232     }
233     }
234     diff -up cpu-1.4.3/src/util/parser.c.mod-delete cpu-1.4.3/src/util/parser.c
235     --- cpu-1.4.3/src/util/parser.c.mod-delete 2010-11-07 16:05:19.000000000 -0700
236     +++ cpu-1.4.3/src/util/parser.c 2010-11-07 16:13:07.000000000 -0700
237     @@ -290,11 +290,7 @@
238     p->cont = true;
239     token = getToken(&cart[i], delim);
240     if ( token == NULL )
241     - {
242     - printf("%d: Malformed file, cannot continue parsing.\n",
243     - __LINE__);
244     - return NULL;
245     - }
246     + token = strdup ("");
247     }
248     p->attrval = delWhite(&token);
249     pos = parse;

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed