1 X-Git-Url: https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=blobdiff_plain;f=iconv%2Fgconv_trans.c;h=e0835fc66684e63964b1376a0c730a70225f63f4;hp=1e25854ccfa84e4f612320f61e6cafa2f955a7d9;hb=a1a6a401ab0a3c9f15fb7eaebbdcee24192254e8;hpb=e4e7cfd287686d26fce2218ed5b2d383db5e338a
3 diff --git a/iconv/gconv_trans.c b/iconv/gconv_trans.c
4 index 1e25854..e0835fc 100644
5 --- a/iconv/gconv_trans.c
6 +++ b/iconv/gconv_trans.c
7 @@ -238,181 +238,12 @@ __gconv_transliterate (struct __gconv_step *step,
8 return __GCONV_ILLEGAL_INPUT;
12 -/* Structure to represent results of found (or not) transliteration
16 - /* This structure must remain the first member. */
17 - struct trans_struct info;
25 -/* Tree with results of previous calls to __gconv_translit_find. */
26 -static void *search_tree;
28 -/* We modify global data. */
29 -__libc_lock_define_initialized (static, lock);
32 -/* Compare two transliteration entries. */
34 -trans_compare (const void *p1, const void *p2)
36 - const struct known_trans *s1 = (const struct known_trans *) p1;
37 - const struct known_trans *s2 = (const struct known_trans *) p2;
39 - return strcmp (s1->info.name, s2->info.name);
43 -/* Open (maybe reopen) the module named in the struct. Get the function
44 - and data structure pointers we need. */
46 -open_translit (struct known_trans *trans)
48 - __gconv_trans_query_fct queryfct;
50 - trans->handle = __libc_dlopen (trans->fname);
51 - if (trans->handle == NULL)
52 - /* Not available. */
55 - /* Find the required symbol. */
56 - queryfct = __libc_dlsym (trans->handle, "gconv_trans_context");
57 - if (queryfct == NULL)
59 - /* We cannot live with that. */
61 - __libc_dlclose (trans->handle);
62 - trans->handle = NULL;
66 - /* Get the context. */
67 - if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames)
71 - /* Of course we also have to have the actual function. */
72 - trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans");
73 - if (trans->info.trans_fct == NULL)
76 - /* Now the optional functions. */
77 - trans->info.trans_init_fct =
78 - __libc_dlsym (trans->handle, "gconv_trans_init");
79 - trans->info.trans_context_fct =
80 - __libc_dlsym (trans->handle, "gconv_trans_context");
81 - trans->info.trans_end_fct =
82 - __libc_dlsym (trans->handle, "gconv_trans_end");
84 - trans->open_count = 1;
92 __gconv_translit_find (struct trans_struct *trans)
94 - struct known_trans **found;
95 - const struct path_elem *runp;
98 - /* We have to have a name. */
99 - assert (trans->name != NULL);
101 - /* Acquire the lock. */
102 - __libc_lock_lock (lock);
104 - /* See whether we know this module already. */
105 - found = __tfind (trans, &search_tree, trans_compare);
108 - /* Is this module available? */
109 - if ((*found)->handle != NULL)
111 - /* Maybe we have to reopen the file. */
112 - if ((*found)->handle != (void *) -1)
113 - /* The object is not unloaded. */
115 - else if (open_translit (*found) == 0)
117 - /* Copy the data. */
118 - *trans = (*found)->info;
119 - (*found)->open_count++;
126 - size_t name_len = strlen (trans->name) + 1;
128 - struct known_trans *newp;
130 - /* We have to continue looking for the module. */
131 - if (__gconv_path_elem == NULL)
132 - __gconv_get_path ();
134 - /* See whether we have to append .so. */
135 - if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0)
138 - /* Create a new entry. */
139 - newp = (struct known_trans *) malloc (sizeof (struct known_trans)
140 - + (__gconv_max_path_elem_len
147 - /* Clear the struct. */
148 - memset (newp, '\0', sizeof (struct known_trans));
150 - /* Store a copy of the module name. */
151 - newp->info.name = cp = (char *) (newp + 1);
152 - cp = __mempcpy (cp, trans->name, name_len);
156 - /* Search in all the directories. */
157 - for (runp = __gconv_path_elem; runp->name != NULL; ++runp)
159 - cp = __mempcpy (__stpcpy ((char *) newp->fname, runp->name),
160 - trans->name, name_len);
162 - memcpy (cp, ".so", sizeof (".so"));
164 - if (open_translit (newp) == 0)
166 - /* We found a module. */
173 - newp->fname = NULL;
175 - /* In any case we'll add the entry to our search tree. */
176 - if (__tsearch (newp, &search_tree, trans_compare) == NULL)
178 - /* Yickes, this should not happen. Unload the object. */
180 - /* XXX unload here. */
185 - __libc_lock_unlock (lock);
188 + /* Transliteration module loading has been removed because it never
189 + worked as intended and suffered from a security vulnerability.
190 + Consequently, this function always fails. */