[SSSD] [PATCH] AD: LDAP component of GPO-based access control

Lukas Slebodnik lslebodn at redhat.com
Wed Apr 30 08:42:32 UTC 2014


On (29/04/14 19:22), Yassir Elley wrote:
>Hi Jakub,
>
>I have attached a revised cumulative patch that aims to address the review comments. 
>
>Additionally, I made the following changes en masse:
>* changed talloc_strdup() to talloc_steal() when applicable (i.e. when dealing with a talloc context)
>* changed all occurrences of strerror() to sss_strerror() in order to use sssd-specific error strings
>
>Thanks,
>Yassir.

>From 5fd5fec3d92daa38e324195de01f8f596b03a0d7 Mon Sep 17 00:00:00 2001
>From: Yassir Elley <yelley at redhat.com>
>Date: Mon, 20 Jan 2014 11:17:06 -0500
>Subject: [PATCH] Implemented LDAP component of GPO-based access control
>
>---
There were same warnings in your patch.
    warning: assignment discards 'const' qualifier from pointer target type

Attached diff fixes some of them.

There is also another warning.
src/providers/ad/ad_gpo.c: In function 'ad_gpo_get_gpo_attrs_done':
sssd/src/providers/ad/ad_gpo.c:2131:19: error: assignment discards 'const'
qualifier from pointer target type [-Werror]
     file_sys_path = talloc_steal(gp_gpo, raw_file_sys_path);
                   ^

There should be strdup, because file_sys_path is modified in function
ad_gpo_convert_to_smb_uri.

LS
-------------- next part --------------
diff --git a/src/providers/ad/ad_gpo.c b/src/providers/ad/ad_gpo.c
index 04eddef..14dd587 100644
--- a/src/providers/ad/ad_gpo.c
+++ b/src/providers/ad/ad_gpo.c
@@ -68,7 +68,7 @@
 /* == common data structures and declarations ============================= */
 
 struct gp_som {
-    char *som_dn;
+    const char *som_dn;
     struct gp_gplink **gplink_list;
     int num_gplinks;
 };
@@ -81,8 +81,8 @@ struct gp_gplink {
 struct gp_gpo {
     struct security_descriptor *gpo_sd;
     char *gpo_dn;
-    char *gpo_guid;
-    char *gpo_display_name;
+    const char *gpo_guid;
+    const char *gpo_display_name;
     char *gpo_file_sys_path;
     uint32_t gpo_container_version;
     char **gpo_cse_guids;
@@ -104,8 +104,8 @@ struct tevent_req *ad_gpo_process_som_send(TALLOC_CTX *mem_ctx,
                                            struct sdap_id_op *sdap_op,
                                            struct sdap_options *opts,
                                            int timeout,
-                                           char *target_dn,
-                                           char *domain_name);
+                                           const char *target_dn,
+                                           const char *domain_name);
 int ad_gpo_process_som_recv(struct tevent_req *req,
                             TALLOC_CTX *mem_ctx,
                             struct gp_som ***som_list);
@@ -513,7 +513,7 @@ struct ad_gpo_access_state {
     struct sss_domain_info *domain;
     char *user;
     char *ad_hostname;
-    char *target_dn;
+    const char *target_dn;
     struct gp_gpo **dacl_filtered_gpos;
     int num_dacl_filtered_gpos;
 };
@@ -881,7 +881,7 @@ static errno_t
 ad_gpo_parent_dn(TALLOC_CTX *mem_ctx,
                  struct ldb_context *ldb_ctx,
                  const char *dn,
-                 char **_parent_dn)
+                 const char **_parent_dn)
 {
     struct ldb_dn *ldb_dn;
     struct ldb_dn *parent_ldb_dn;
@@ -919,7 +919,7 @@ ad_gpo_parent_dn(TALLOC_CTX *mem_ctx,
 static errno_t
 ad_gpo_populate_som_list(TALLOC_CTX *mem_ctx,
                          struct ldb_context *ldb_ctx,
-                         char *target_dn,
+                         const char *target_dn,
                          int *_num_soms,
                          struct gp_som ***_som_list)
 {
@@ -928,8 +928,8 @@ ad_gpo_populate_som_list(TALLOC_CTX *mem_ctx,
     int rdn_count = 0;
     int som_idx = 0;
     struct gp_som **som_list;
-    char *parent_dn = NULL;
-    char *tmp_dn = NULL;
+    const char *parent_dn = NULL;
+    const char *tmp_dn = NULL;
     struct ldb_dn *ldb_target_dn;
 
     tmp_ctx = talloc_new(NULL);
@@ -1016,7 +1016,7 @@ ad_gpo_populate_som_list(TALLOC_CTX *mem_ctx,
  */
 static errno_t
 ad_gpo_populate_gplink_list(TALLOC_CTX *mem_ctx,
-                            char *som_dn,
+                            const char *som_dn,
                             char *raw_gplink_value,
                             struct gp_gplink ***_gplink_list,
                             bool allow_enforced_only)
@@ -1190,8 +1190,8 @@ ad_gpo_process_som_send(TALLOC_CTX *mem_ctx,
                         struct sdap_id_op *sdap_op,
                         struct sdap_options *opts,
                         int timeout,
-                        char *target_dn,
-                        char *domain_name)
+                        const char *target_dn,
+                        const char *domain_name)
 {
     struct tevent_req *req;
     struct tevent_req *subreq;
@@ -1411,7 +1411,7 @@ ad_gpo_get_som_attrs_step(struct tevent_req *req)
     /* gp_som is NULL only after all SOMs have been processed */
     if (gp_som == NULL) return EOK;
 
-    char *som_dn = gp_som->som_dn;
+    const char *som_dn = gp_som->som_dn;
     subreq = sdap_get_generic_send(state, state->ev,  state->opts,
                                    sdap_id_op_handle(state->sdap_op),
                                    som_dn, LDAP_SCOPE_BASE,


More information about the sssd-devel mailing list