:: Re: [DNG] How to test the backend o…
Página Inicial
Delete this message
Reply to this message
Autor: aitor_czr
Data:  
Para: dng
Assunto: Re: [DNG] How to test the backend of simple-netaid
Hi,

El 08/09/18 a las 11:50, aitor_czr escribió:
>
> El 08/09/18 a las 11:47, aitor_czr escribió:
>>
>> The idea is very simple. The GUI and the suid binary will contain a
>> non-existent header:
>>
>> #include "key.h"
>>
>> The key.h file will contain an unique line (the random definition of
>> the KEY varible) edited by CMake during the compilation. For example:
>>
>> var1="#define KEY "
>> var2=`tr -cd '[:alnum:]' < /dev/urandom | fold -w32 | head -n1`
>> echo "${var1}\"${var2}\"" > key.h
>>
>> would generate something like this:
>>
>> #define KEY "X1AULvFge6Tgq1p9BZat4EEVqAwaCnsB"
>>
>> and then, the suid binary only will be able to be run from the GUI,
>> built together with it.
>>
>> Cheers,
>>
>>   Aitor.
>
> The CLI version of simple-netaid will ask you for root's password.


I pushed the most recent code of simple-netaid to gitlab.

https://git.devuan.org/aitor_czr/simple-netaid-gtk/tree/master

You'll find some commented parts focused to Gtk3. You'll find also
several smart pointers like this:

Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;

Don't panic!

In spanish we call them "punteros inteligentes":

auto_ptr<some_type>

But these concrete smartpointers are not general purpose smartpointers.
They should not be used with widgets. They should only be used with
classes that force you to use it - by having no public constructor but
having public create*() methods, as Murray Cumming explains in the
following link:

https://stackoverflow.com/questions/22373506/gtkmm-using-refptr-with-widgets-kept-in-stdvector

Now, i would like to do some clarifications:

- The code of the main menu and the toolbar still is not implemented
(give me a few hours).

- There is a segmentation fault closing the application, i still have
not located it.

- The thread defined in the main.cpp:

https://git.devuan.org/aitor_czr/simple-netaid-gtk/blob/master/src/main.cpp

waits for the window-main-worker-thread for 10 seconds (line nº 90 in
main.cpp). So, if you want to debug simple-netaid using Valgrind, you
will need to increase this value.

The new simple-netaid, with its strengths and weaknesses :)

Hope you like it,

  Aitor.