<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>53959</bug_id>
          
          <creation_ts>2025-04-23 15:24:34 +0300</creation_ts>
          <short_desc>Проблемы при создании общей сетевой папки без гостевого доступа (атрибут self._guest прибит)</short_desc>
          <delta_ts>2025-10-14 16:38:59 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>gpupdate</component>
          <version>unstable</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Vladislav Glinkin">glinkinvd</reporter>
          <assigned_to name="Valery Sinelnikov">greh</assigned_to>
          <cc>greh</cc>
    
    <cc>kunitskijds</cc>
    
    <cc>nir</cc>
    
    <cc>sin</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>263423</commentid>
    <comment_count>0</comment_count>
    <who name="Vladislav Glinkin">glinkinvd</who>
    <bug_when>2025-04-23 15:24:34 +0300</bug_when>
    <thetext>Версия: gpupdate-0.13.2-alt1

Шаги воспроизведения:
1) На управляющей машине включить экспериментальные групповые политики и настроить механизмы GPUpdate для подключения сетевых каталогов
2) На клиентах добавить include = /etc/samba/usershares.conf в секцию global файла /etc/samba/smb.conf
3) На клиентах предварительно создать директорию mkdir /var/cshare &amp;&amp; chmod 777 /var/cshare для share
4) На клиентах выполнить # control smb-conf-usershares enabled &amp;&amp; control smb-conf-usershare-owner-only disabled
5) На управляющей машине создать сетевую папку cshare для компьютера:
Действие: Создание
Имя шары: cshare
Путь к каталогу: /var/cshare
Комментарий: computer share
Нажать OK
6) Применить групповые политики на клиенте

Всё в соответствии с https://www.altlinux.org/%D0%93%D1%80%D1%83%D0%BF%D0%BF%D0%BE%D0%B2%D1%8B%D0%B5_%D0%BF%D0%BE%D0%BB%D0%B8%D1%82%D0%B8%D0%BA%D0%B8/%D0%9E%D0%B1%D1%89%D0%B8%D0%B5_%D0%BA%D0%B0%D1%82%D0%B0%D0%BB%D0%BE%D0%B3%D0%B8#%D0%9E%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5

Фактический результат:
Сетевая папка не была создана.
2025-04-23 13:16:39.859|[D00182]| Не удалось применить действие с данными общего сетевого ресурса|{&apos;cmd&apos;: [&apos;/usr/bin/net&apos;, &apos;usershare&apos;, &apos;add&apos;, &apos;cshare&apos;, &apos;/var/cshare&apos;, &apos;computer share&apos;, &apos;Everyone:F&apos;, &apos;guest_ok=y&apos;], &apos;exc&apos;: CalledProcessError(255, [&apos;/usr/bin/net&apos;, &apos;usershare&apos;, &apos;add&apos;, &apos;cshare&apos;, &apos;/var/cshare&apos;, &apos;computer share&apos;, &apos;Everyone:F&apos;, &apos;guest_ok=y&apos;])}

Ожидаемый результат:
Сетевая папка создана.

====

net usershare add [--long] &lt;sharename&gt; &lt;path&gt; [&lt;comment&gt;] [&lt;acl&gt;] [&lt;guest_ok=[y|n]&gt;]
        Adds the specified share name for this user.
        &lt;sharename&gt; is the new share name.
        &lt;path&gt; is the path on the filesystem to export.
        &lt;comment&gt; is the optional comment for the new share.
        &lt;acl&gt; is an optional share acl in the format &quot;DOMAIN\name:X,DOMAIN\name:X,....&quot;
        &lt;guest_ok=y&gt; if present sets &quot;guest ok = yes&quot; on this usershare.
                &quot;X&quot; represents a permission and can be any one of the characters f, r or d
                where &quot;f&quot; means full control, &quot;r&quot; means read-only, &quot;d&quot; means deny access.
                name may be a domain user or group. For local users use the local server name instead of &quot;DOMAIN&quot;
                The default acl is &quot;Everyone:r&quot; which allows everyone read-only access.

Обязательными параметрами являются &lt;sharename&gt; и &lt;path&gt;.

В классе Networkshare прибит self._guest = &apos;guest_ok=y&apos;
class Networkshare:

    def __init__(self, networkshare_obj, username = None):
        self.net_full_cmd = [&apos;/usr/bin/net&apos;, &apos;usershare&apos;]
        self.net_cmd_check = [&apos;/usr/bin/net&apos;, &apos;usershare&apos;, &apos;list&apos;]
        self.cmd = list()
        self.name = networkshare_obj.name
        self.path = expand_windows_var(networkshare_obj.path, username).replace(&apos;\\&apos;, &apos;/&apos;) if networkshare_obj.path else None

        self.action = action_letter2enum(networkshare_obj.action)
        self.allRegular =  networkshare_obj.allRegular
        self.comment = networkshare_obj.comment
        self.limitUsers = networkshare_obj.limitUsers
        self.abe = networkshare_obj.abe
        self._guest = &apos;guest_ok=y&apos;
        self.acl = &apos;Everyone:&apos;
        self.act()

В случаях, когда в конфигурационном файле usershare allow guests = no, возникают ошибки:
2025-04-23 13:16:39.859|[D00182]| Не удалось применить действие с данными общего сетевого ресурса|{&apos;cmd&apos;: [&apos;/usr/bin/net&apos;, &apos;usershare&apos;, &apos;add&apos;, &apos;cshare&apos;, &apos;/var/cshare&apos;, &apos;computer share&apos;, &apos;Everyone:F&apos;, &apos;guest_ok=y&apos;], &apos;exc&apos;: CalledProcessError(255, [&apos;/usr/bin/net&apos;, &apos;usershare&apos;, &apos;add&apos;, &apos;cshare&apos;, &apos;/var/cshare&apos;, &apos;computer share&apos;, &apos;Everyone:F&apos;, &apos;guest_ok=y&apos;])}

Потому что:
# net usershare add &quot;cshare&quot; &quot;/var/cshare&quot; &quot;computer share&quot; &quot;Everyone:F&quot; &quot;guest_ok=y&quot;
net usershare add: guest_ok=y requested but the &quot;usershare allow guests&quot; parameter is not enabled by this server.

Причём, usershare allow guests можно настраивать политикой &quot;Гостевой доступ к общим каталогам&quot; и сломать всё, если запретить его.

Параметр acl тоже прибит со значением Everyone:F, но он не настраивается в /etc/samba/usershares.conf
Было бы славно, для повышение гибкости настройки, настраивать acl с помощью какой-нибудь групповой политики (это скорее улучшение на будущее).

Исправление описанной проблемы с self._guest в https://github.com/altlinux/gpupdate/pull/214</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>274458</commentid>
    <comment_count>1</comment_count>
    <who name="Куницкий Дмитрий">kunitskijds</who>
    <bug_when>2025-10-14 16:38:59 +0300</bug_when>
    <thetext>Данная ошибка не воспроизводится на образе Alt workstation K 1.1.1 x86_64. 

На образах
Alt education kde/xfce x86_64 и Alt workstation x86_64 ошибка так же актуальна.

Версии пакетов: 
admx-basealt-0.6.0-alt
gpupdate-0.13.3-alt1</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>