[DNG] Debugging netman auto-connect.

2015-09-11 Thread Edward Bartolo
Hi all,

Since yesterday I have been trying to understand why "char**
essid_list" is working inside getInstalledEssidList(&count,
essid_list) but failing as soon as I try to access essid_list[0]
outside the function.

Both the source and the gdb text output are attached.

Any helpful pointers are appreciated.


Edward.
gdb auto-conn
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from auto-conn...done.
(gdb) b 202
Breakpoint 1 at 0x401223: file automated_scanner.c, line 202.
(gdb) r
Starting program: /home/edbarx/netman/backend_src/src/auto-conn 

Breakpoint 1, autoWirelessScanPlus () at automated_scanner.c:202
202 getInstalledEssidList(&count, essid_list);
(gdb) s
getInstalledEssidList (count=0x7fffe284, essid_list=0x1) at 
automated_scanner.c:48
48  int el_size = 0; // stands for essid_list size
(gdb) n
51  if ((dir = opendir(IFACES_PATH)) != 0) {
(gdb) n
52  while ((ent = readdir (dir)) != 0)
(gdb) n
54  strcmp(".", ent->d_name) != 0 && 
(gdb) n
53  if(
(gdb) n
52  while ((ent = readdir (dir)) != 0)
(gdb) n
54  strcmp(".", ent->d_name) != 0 && 
(gdb) n
53  if(
(gdb) n
55  strcmp("..", ent->d_name) != 0
(gdb) n
54  strcmp(".", ent->d_name) != 0 && 
(gdb) n
57  (*count)++;
(gdb) n
62  encoded_essid = ent->d_name;
(gdb) n
63  if (el_size < *count) {
(gdb) p encoded_essid
$1 = 0x60206b "EB-TP-LNK67"
(gdb) n
64  el_size =+ 10;
(gdb) n
65  if (el_size == 10)
(gdb) n
66  essid_list = 
calloc(*count + 9, sizeof(char*));
(gdb) n
70  essid_list[*count - 1] = 
calloc(strlen(encoded_essid) + 1, sizeof(char));
(gdb) n
71  strcpy(essid_list[*count - 1], 
encoded_essid);
(gdb) n
52  while ((ent = readdir (dir)) != 0)
(gdb) p essid_list[0]
$2 = 0x60a0b0 "EB-TP-LNK67"
(gdb) n
54  strcmp(".", ent->d_name) != 0 && 
(gdb) n
53  if(
(gdb) n
55  strcmp("..", ent->d_name) != 0
(gdb) n
54  strcmp(".", ent->d_name) != 0 && 
(gdb) n
52  while ((ent = readdir (dir)) != 0)
(gdb) n
73  closedir(dir);
(gdb) n
87  return 0;
(gdb) n
88  }
(gdb) n
autoWirelessScanPlus () at automated_scanner.c:206
206 getRadiatingWifiList(&active_wifis, active_wifi_list);
(gdb) p essid_list[0]
Cannot access memory at address 0x1
(gdb) s
getRadiatingWifiList (active_wifis=0x7fffe280, active_wifi_list=0x0) at 
automated_scanner.c:94
94  char * scan_buffer = NULL;
(gdb) n
96  scan_buffer = calloc(1024, 1);
(gdb) n
99  shell_reader = popen("/sbin/iwlist wlan0 scan | grep 
\"Quality=\\|ESSID:\"", "r");
(gdb) n
101 if(!shell_reader) {
(gdb) n
113 int z = 0;
(gdb) n
115 *active_wifis = -1;
(gdb) n
116 while((scan_buffer = fgets(scan_buffer, 1024, shell_reader)))
(gdb) n
118 z++;
(gdb) n
119 if (z == 1) 
(gdb) n
120 active_wifi_list = calloc(sizeof(void*), 10);
(gdb) n
124 if (z % 2 == 1) {
(gdb) n
125 active_wifis++;
(gdb) n
126 tmp_wifi_quality = 
calloc(sizeof(wifi_quality), 1);
(gdb) n
127 active_wifi_list[*active_wifis] = 
tmp_wifi_quality;
(gdb) n
129 char* substr = strstr((char *) 
scan_buffer, "Signal level=");
(gdb) n
130 substr = strstr(substr, "=");
(gdb) n
131 char* endstr = strstr(substr + 1, " ");
(gdb) n
133 strncpy(tmpstr, substr + 1, e

Re: [DNG] libpam-xdg-support / libpam-systemd

2015-09-11 Thread tilt!

On 09/11/2015 03:33 AM, Daniel Reurich wrote:
> [...]
> We could either use $USER_$SESSIONID or $USER/$SESSIONID to
> implement multiple sessions per user.
> [...]

Hi Daniel,

what is $SESSIONID? How is the value determined?

Kind regards,
T.
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] libpam-xdg-support / libpam-systemd

2015-09-11 Thread tilt!

On 09/11/2015 07:33 AM, tilt! wrote:
> [...]
> #1 A "prefix" for XDG_RUNTIME_DIR, meaning the directory where
> runtime directories are created; [...]
>
>XDG_RUNTIME_PREFIX="/tmp/xdg-runtime/user"
>
> This definition could go to "/etc/xdg/runtime-prefix.default"
>
> #2 A procedure that, if called with no arguments, considers the
> setting of #1 and returns a value for XDG_RUNTIME_DIR for the current
> user:
>
>. /etc/xdg/runtime-prefix.default
>
>xdg_runtime_dir_default() {
>   echo "$XDG_RUNTIME_PREFIX/$(/usr/bin/id -ru)"
>}
>
> This code could go to "/etc/xdg/runtime-dir-default.sh".
>
> #3 An integration in the X session that applies these settings:
>
>. /etc/xdg/runtime-dir-default.sh
>
>export XDG_RUNTIME_DIR="$(xdg_runtime_dir_default)"
>
> This code could go to "/etc/X11/Xsession.d/61xdg-runtime-dir".
> [...]

Unaddressed remained the deletion of $XDG_RUNTIME_DIR when a user
has "fully logged out" as mandated by [2].


Ok, that's an understatement, correct is:

Unadressed remains the lifecycle of $XDG_RUNTIME_DIR, specifically:

* When is $XDG_RUNTIME_PREFIX created?

  If $XDG_RUNTIME_PREFIX hosts every user's runtime directory,
  it may not be created with ownership of the user, so to do
  this alone:

 # as user:

 mkdir -p -m 700 "$XDG_RUNTIME_DIR" # wrong!

  is the wrong approach, the prefix has to be created owned by
  root, readable by all, and subdirectories have to be created
  owned by user, read/writeable for user only.

 # as root:

 mkdir -p -m 755 "$XDG_RUNTIME_PREFIX"

  Currently my best guess is that this should be performed
  at system startup.

* When is $XDG_RUNTIME_DIR created?

  If the prefix is created like described above, it requires
  root permissions to create the per-user directory:

# as root:

# let $uid be the user ID of the affected user;
# let $xdg:runtime_dir be the requested runtime directory:

if ! test -d "$xdg_runtime_dir" ; then
   mkdir -p -m 700 "$xdg_runtime_dir"
   chown $uid:$(id -g $uid) "$xdg_runtime_dir"
fi

  Currently my best guess is that this should be performed
  everytime the user starts an X session (it's an X thing
  after all, right), but Xsession.d is executed as the
  user, not root. Changing into the user ID is a thing of
  the display manager, there's no general way to hook in.
  Remains PAM. Probably.

* When is $XDG_RUNTIME_DIR deleted?

  If the per-user runtime directory is created as i described
  above, user permissions suffice to delete it, so it was
  sufficent to

# as user:

rm -rf "$XDG_RUNTIME_DIR"

  Unfortunately i am in the dark over what it means that a
  user has "fully logged out". Does it mean that no processes
  run with the user's identity anymore? That the user has no
  X session running? That the user has no PAM session running?
  And, if any of these mean that the user has "fully logged
  out", how to hook into such an event and perform the code
  suggested above?

Kind regards,
T.

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread tilt!

On 09/11/2015 10:35 AM, Edward Bartolo wrote:

Hi all,

Since yesterday I have been trying to understand why "char**
essid_list" is working inside getInstalledEssidList(&count,
essid_list) but failing as soon as I try to access essid_list[0]
outside the function.

Both the source and the gdb text output are attached.

Any helpful pointers are appreciated.


Having dynamically growing (and shrinking) lists in C is
always a problem. That's why the problem has been solved
many times. :-)

For example, the singly-linked list, GSList, from the GLIB
library is pretty popular and could save you some time.

I have attached an example program to demonstrate how GSList
can be used to manage a list of allocated C-type strings.

Best regards,
T.

/* An example program for GSList.
 *
 * Compile with:
 *
 *gcc $(pkg-config --libs glib-2.0 --cflags glib-2.0 ) -o example example.c
 *
 * */

#include 
#include 
#include 

#include 

char * teststring[] = { "hello", "world", NULL };

int main(int argc, char** argv) {
GSList * list = NULL;

// Fill the example list:
char ** a_string = teststring;

while(*a_string) {
list = g_slist_append(list, strdup(*a_string));
a_string++;
}

// Iterate the filled list:
int i = 0, l = g_slist_length(list);

for(i=0; i___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Rainer Weikusat
Edward Bartolo  writes:
> Since yesterday I have been trying to understand why "char**
> essid_list" is working inside getInstalledEssidList(&count,
> essid_list) but failing as soon as I try to access essid_list[0]
> outside the function.
>
> Both the source and the gdb text output are attached.
>
> Any helpful pointers are appreciated.

The prototype of getInstalledEssidList is

int getInstalledEssidList(int* count, char** essid_list)

and you call that as

char** essid_list;

[...]

getInstalledEssidList(&count, essid_list);

C passes everything by value, hence, getInstalledEssidList gets called
with a copy of the value of the essid_list of the caller (an
uninitialized pointer) and then goes on to modify this copy, ie, changes
don't affect anything outside of the function. In theory, you could pass
a *** and then modify the original pointer but it's a good idea to avoid
avoidable levels of indirection. The easiest way to do something like
this is to return the char ** from the function, returning NULL to
signal failure/ "didn't find anyhting".

NB: getRadiatingWifiList obviously suffers from the same problem and
will need to be modified in the same way.

--
--- automated_scanner.c 2015-09-11 14:42:34.319852358 +0100
+++ a.c 2015-09-11 14:50:28.937357676 +0100
@@ -41,11 +41,14 @@
 } wifi_quality;
 
 
-int getInstalledEssidList(int* count, char** essid_list)
+char **getInstalledEssidList(int* count)
 {
+   char **essid_list;
DIR * dir;
struct dirent * ent;
int el_size = 0; // stands for essid_list size
+
+   essid_list = NULL;
 
// First get a list of installed wireless "interfaces" files
if ((dir = opendir(IFACES_PATH)) != 0) {
@@ -81,10 +84,10 @@
IFACES_PATH, strerror(errno)
);
 
-   return old_errno;
+   return NULL;
}
 
-   return 0;
+   return essid_list;
 }
 
 int getRadiatingWifiList(int* active_wifis, void** active_wifi_list)
@@ -199,7 +202,7 @@
char* scan_buffer;
 
// get a list of currently installed wifi essids
-   getInstalledEssidList(&count, essid_list);
+   essid_list = getInstalledEssidList(&count);
//fprintf(stdout, essid_list[0], "\n"); 
 
// get a list of irradiating wifis
-
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Rainer Weikusat
"tilt!"  writes:
> On 09/11/2015 10:35 AM, Edward Bartolo wrote:
>> Hi all,
>>
>> Since yesterday I have been trying to understand why "char**
>> essid_list" is working inside getInstalledEssidList(&count,
>> essid_list) but failing as soon as I try to access essid_list[0]
>> outside the function.
>>
>> Both the source and the gdb text output are attached.
>>
>> Any helpful pointers are appreciated.
>
> Having dynamically growing (and shrinking) lists in C is
> always a problem. That's why the problem has been solved
> many times. :-)
>
> For example, the singly-linked list, GSList, from the GLIB
> library is pretty popular and could save you some time.

JFTR: That part of the code is works.
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Edward Bartolo
As suggested by tilt, I switched to use GSList but I need to use it
for two distinct cases:
a) to manage a list of strings
b) to manage a list of structures of this construct:

typedef struct {
double quality;
char name[MAX_ESSID_LENGTH];
} wifi_quality;

I expect this to be possible as lists may not always be lists of strings.

In the case it is possible to use GSList to manage lists of custom
structures like the above, which function the type of strdup is used
to allocate memory and prepare a structure so that it would be added
to the list?

I also need to swap two items in the list in a sorting function.

Edward

On 11/09/2015, Rainer Weikusat  wrote:
> "tilt!"  writes:
>> On 09/11/2015 10:35 AM, Edward Bartolo wrote:
>>> Hi all,
>>>
>>> Since yesterday I have been trying to understand why "char**
>>> essid_list" is working inside getInstalledEssidList(&count,
>>> essid_list) but failing as soon as I try to access essid_list[0]
>>> outside the function.
>>>
>>> Both the source and the gdb text output are attached.
>>>
>>> Any helpful pointers are appreciated.
>>
>> Having dynamically growing (and shrinking) lists in C is
>> always a problem. That's why the problem has been solved
>> many times. :-)
>>
>> For example, the singly-linked list, GSList, from the GLIB
>> library is pretty popular and could save you some time.
>
> JFTR: That part of the code is works.
> ___
> Dng mailing list
> Dng@lists.dyne.org
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Edward Bartolo
I will try the solution from Rainer as it seems to do the least of
disruption to my original code.

Thanks to you all,
Edward

On 11/09/2015, Edward Bartolo  wrote:
> As suggested by tilt, I switched to use GSList but I need to use it
> for two distinct cases:
> a) to manage a list of strings
> b) to manage a list of structures of this construct:
>
> typedef struct {
>   double quality;
>   char name[MAX_ESSID_LENGTH];
> } wifi_quality;
>
> I expect this to be possible as lists may not always be lists of strings.
>
> In the case it is possible to use GSList to manage lists of custom
> structures like the above, which function the type of strdup is used
> to allocate memory and prepare a structure so that it would be added
> to the list?
>
> I also need to swap two items in the list in a sorting function.
>
> Edward
>
> On 11/09/2015, Rainer Weikusat  wrote:
>> "tilt!"  writes:
>>> On 09/11/2015 10:35 AM, Edward Bartolo wrote:
 Hi all,

 Since yesterday I have been trying to understand why "char**
 essid_list" is working inside getInstalledEssidList(&count,
 essid_list) but failing as soon as I try to access essid_list[0]
 outside the function.

 Both the source and the gdb text output are attached.

 Any helpful pointers are appreciated.
>>>
>>> Having dynamically growing (and shrinking) lists in C is
>>> always a problem. That's why the problem has been solved
>>> many times. :-)
>>>
>>> For example, the singly-linked list, GSList, from the GLIB
>>> library is pretty popular and could save you some time.
>>
>> JFTR: That part of the code is works.
>> ___
>> Dng mailing list
>> Dng@lists.dyne.org
>> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>>
>
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] How to get Suckless-init source. Was: Doing away with multi-threading in my project (netman)

2015-09-11 Thread dan pridgeon

  From: Steve Litt 
 To: dng@lists.dyne.org 
 Sent: Thursday, September 3, 2015 11:35 AM
 Subject: Re: [DNG] Doing away with multi-threading in my project (netman)
   
On Thu, 3 Sep 2015 07:38:13 +0100
Edward Bartolo  wrote:

. I know that's how suckless-init works. I suggest you 
downloadSuckless-Init and look at its source: It's only 83 non-blank lines.


SteveT

Posting as requested by Steve.

On Thu, 3 Sep 2015 17:13:25 + (UTC)
dan pridgeon  wrote:

> "I suggest you download
> Suckless-Init and look at its source: It's only 83 non-blank lines."
> Steve, can you help me get off the learning curve to the learning
> curve by showing me  how to get this source?  I'd like to look at it
> and it looks like its small enough that I can get my arms around it.
> ...
> Thanks, Dan, 

Hi Dan,

Browse to the following:

http://git.suckless.org/sinit

Click on sinit-1.0.tar.gz and download to an empty directory, or
download and then move to an empty directory.

Perform the following command:

tar xzvf sinit-1.0.tar.gz

cd sinit-1.0

Use an editor to look at README, sinit.c, and all the other files.

Dan, please relay this information to the DNG list in case others have
the same question.

Thanks,
Steve
 Thanks SteveT.  ___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


[DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

Hi Edward,

Consider a double pointer like a matrix (in algebra) witch one you don't 
know its dimension a priori.


An example: put the case that we are developing an application witch 
calculates the inverse of a matrix of dimensions NxM. The values of N 
and M will be determinated by the user and they are unknown a priori. If 
so, we declare a doble pointer:


float **ptr;

The application asks to the user the values of of the number of files 
(N) and columns (M), and according to them it reserves the "necessary 
and sufficient" memory:


ptr = (float**) malloc(files* sizeof(float*);

  for (i=0; iOnce the application has calculated the resulting inverse matrix MxN, we 
must delete the memory *manually*.


Aitor.


On 11/09/15 10:35, Edward Bartolo  wrote:

Hi all,

Since yesterday I have been trying to understand why "char**
essid_list" is working inside getInstalledEssidList(&count,
essid_list) but failing as soon as I try to access essid_list[0]
outside the function.

Both the source and the gdb text output are attached.

Any helpful pointers are appreciated.


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Edward Bartolo
Hi Aitor,

auto-connect successfully sorted the available wifi signals according
to strength and finally it connected to my wifi. Hurray!

The next test, is to include more wifi interfaces files and test
whether it can select the wifi with the best signal and choose the
corresponding interfaces file. I have the feeling that it will soon be
part of netman.

Thanks for your explanation about an NxM matrix. I am qualified in
mathematics, before somebody else pops in, only square matrices can
have an inverse. Imagine having N linear equations with N unknowns:
the matrix's elements would be the variables' coefficients and the RHS
would be a column matrix with N rows and 1 column.

Edward

On 11/09/2015, aitor_czr  wrote:
> Hi Edward,
>
> Consider a double pointer like a matrix (in algebra) witch one you don't
> know its dimension a priori.
>
> An example: put the case that we are developing an application witch
> calculates the inverse of a matrix of dimensions NxM. The values of N
> and M will be determinated by the user and they are unknown a priori. If
> so, we declare a doble pointer:
>
> float **ptr;
>
> The application asks to the user the values of of the number of files
> (N) and columns (M), and according to them it reserves the "necessary
> and sufficient" memory:
>
> ptr = (float**) malloc(files* sizeof(float*);
>
>for (i=0; i
>ptr[i] = (float*) malloc(columns*sizeof(float));
>
> Once the application has calculated the resulting inverse matrix MxN, we
> must delete the memory *manually*.
>
> Aitor.
>
>
> On 11/09/15 10:35, Edward Bartolo  wrote:
>> Hi all,
>>
>> Since yesterday I have been trying to understand why "char**
>> essid_list" is working inside getInstalledEssidList(&count,
>> essid_list) but failing as soon as I try to access essid_list[0]
>> outside the function.
>>
>> Both the source and the gdb text output are attached.
>>
>> Any helpful pointers are appreciated.
>
>
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

No!

Only square matrices can have a determinant.

I am not Roger Penrose. I am a hooligan of *Richard Feynman* and *Lev 
Davidovick Landau* (vintage).


Yes, i know... There are many hooligans in this forum. There is a 
special black hole in the heaven for that guys.


Aitor.

El 11/09/15 a las 19:32, Edward Bartolo escribió:

only square matrices can
have an inverse


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread tilt!

Perfect - avoids the GLIB dependency, too :)

GLIB is a bloated beast anyway, comes with an XML parser, an own 
threading system, i bet somewhere in there is a fully featured telnet 
client and a mail program, too.


Thank you Rainer for extreme (C) programming. ;-)

Regards,
T.

On 09/11/2015 04:44 PM, Edward Bartolo wrote:

I will try the solution from Rainer as it seems to do the least of
disruption to my original code.

Thanks to you all,
Edward

On 11/09/2015, Edward Bartolo  wrote:

As suggested by tilt, I switched to use GSList but I need to use it
for two distinct cases:
a) to manage a list of strings
b) to manage a list of structures of this construct:

typedef struct {
double quality;
char name[MAX_ESSID_LENGTH];
} wifi_quality;

I expect this to be possible as lists may not always be lists of strings.

In the case it is possible to use GSList to manage lists of custom
structures like the above, which function the type of strdup is used
to allocate memory and prepare a structure so that it would be added
to the list?

I also need to swap two items in the list in a sorting function.

Edward

On 11/09/2015, Rainer Weikusat  wrote:

"tilt!"  writes:

On 09/11/2015 10:35 AM, Edward Bartolo wrote:

Hi all,

Since yesterday I have been trying to understand why "char**
essid_list" is working inside getInstalledEssidList(&count,
essid_list) but failing as soon as I try to access essid_list[0]
outside the function.

Both the source and the gdb text output are attached.

Any helpful pointers are appreciated.

Having dynamically growing (and shrinking) lists in C is
always a problem. That's why the problem has been solved
many times. :-)

For example, the singly-linked list, GSList, from the GLIB
library is pretty popular and could save you some time.

JFTR: That part of the code is works.
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng



___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Edward Bartolo
Hi all,

auto-conn successfully connected to my wifi notwithstanding I had more
than one "interfaces" file installed for the wifis belonging to two
sisters. So, it had to decide which file to use from three "essid"
files.

Internally, it sorts the available wifi signals according to strength
starting from the strongest source. This function was tested
successfully. Nest time, I will do the testing at my sister's home to
actually test the pudding in the eating, and I have a feeling, it will
taste wonderful.

GLib dependency avoided successfully.

Edward.

On 11/09/2015, tilt!  wrote:
> Perfect - avoids the GLIB dependency, too :)
>
> GLIB is a bloated beast anyway, comes with an XML parser, an own
> threading system, i bet somewhere in there is a fully featured telnet
> client and a mail program, too.
>
> Thank you Rainer for extreme (C) programming. ;-)
>
> Regards,
> T.
>
> On 09/11/2015 04:44 PM, Edward Bartolo wrote:
>> I will try the solution from Rainer as it seems to do the least of
>> disruption to my original code.
>>
>> Thanks to you all,
>> Edward
>>
>> On 11/09/2015, Edward Bartolo  wrote:
>>> As suggested by tilt, I switched to use GSList but I need to use it
>>> for two distinct cases:
>>> a) to manage a list of strings
>>> b) to manage a list of structures of this construct:
>>>
>>> typedef struct {
>>> double quality;
>>> char name[MAX_ESSID_LENGTH];
>>> } wifi_quality;
>>>
>>> I expect this to be possible as lists may not always be lists of
>>> strings.
>>>
>>> In the case it is possible to use GSList to manage lists of custom
>>> structures like the above, which function the type of strdup is used
>>> to allocate memory and prepare a structure so that it would be added
>>> to the list?
>>>
>>> I also need to swap two items in the list in a sorting function.
>>>
>>> Edward
>>>
>>> On 11/09/2015, Rainer Weikusat  wrote:
 "tilt!"  writes:
> On 09/11/2015 10:35 AM, Edward Bartolo wrote:
>> Hi all,
>>
>> Since yesterday I have been trying to understand why "char**
>> essid_list" is working inside getInstalledEssidList(&count,
>> essid_list) but failing as soon as I try to access essid_list[0]
>> outside the function.
>>
>> Both the source and the gdb text output are attached.
>>
>> Any helpful pointers are appreciated.
> Having dynamically growing (and shrinking) lists in C is
> always a problem. That's why the problem has been solved
> many times. :-)
>
> For example, the singly-linked list, GSList, from the GLIB
> library is pretty popular and could save you some time.
 JFTR: That part of the code is works.
 ___
 Dng mailing list
 Dng@lists.dyne.org
 https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

>
>
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] libpam-xdg-support / libpam-systemd

2015-09-11 Thread Isaac Dunham
On Fri, Sep 11, 2015 at 11:23:38AM +0200, tilt! wrote:
> Unadressed remains the lifecycle of $XDG_RUNTIME_DIR, specifically:
> 
> * When is $XDG_RUNTIME_PREFIX created?
> 
>   If $XDG_RUNTIME_PREFIX hosts every user's runtime directory,
>   it may not be created with ownership of the user, so to do
>   this alone:
> 
>  # as user:
> 
>  mkdir -p -m 700 "$XDG_RUNTIME_DIR" # wrong!
> 
>   is the wrong approach, the prefix has to be created owned by
>   root, readable by all, and subdirectories have to be created
>   owned by user, read/writeable for user only.
> 
>  # as root:
> 
>  mkdir -p -m 755 "$XDG_RUNTIME_PREFIX"
> 
>   Currently my best guess is that this should be performed
>   at system startup.

Yes.

> * When is $XDG_RUNTIME_DIR created?
> 
>   If the prefix is created like described above, it requires
>   root permissions to create the per-user directory:
> 
> # as root:
> 
> # let $uid be the user ID of the affected user;
> # let $xdg:runtime_dir be the requested runtime directory:
> 
> if ! test -d "$xdg_runtime_dir" ; then
>mkdir -p -m 700 "$xdg_runtime_dir"
>chown $uid:$(id -g $uid) "$xdg_runtime_dir"
> fi
> 
>   Currently my best guess is that this should be performed
>   everytime the user starts an X session (it's an X thing
>   after all, right), but Xsession.d is executed as the
>   user, not root. Changing into the user ID is a thing of
>   the display manager, there's no general way to hook in.
>   Remains PAM. Probably.

PAM would probably work well.

If I were implementing it (note: I'm the sort of guy who doesn't use
PAM, or logind, or policykit...), I'd use a setuid helper that will
construct a path based on a fixed prefix, the user ID, and optionally
a six-character random string (ie, the "-n" option appends _XX and
calls mktemp).
It will then create this directory, change the owner and permissions,
and print it to stdout, so that you could do:
XDG_RUNTIME_DIR=`mkxdgrt -n`
if you want a new session.
This helper would be called from the login or X startup scripts.

Alternately, you could theoretically create a new mount namespace for
each user (at login, check if there are any processes with the target
uid, and if so join their namespace).
If you created a new namespace, mount some sort of RAM-backed filesystem
with a size limit at XDG_RUNTIME_DIR; its contents will go away with the
last user process.

> * When is $XDG_RUNTIME_DIR deleted?
> 
>   If the per-user runtime directory is created as i described
>   above, user permissions suffice to delete it, so it was
>   sufficent to
> 
> # as user:
> 
> rm -rf "$XDG_RUNTIME_DIR"
> 
>   Unfortunately i am in the dark over what it means that a
>   user has "fully logged out". Does it mean that no processes
>   run with the user's identity anymore? That the user has no
>   X session running? That the user has no PAM session running?
>   And, if any of these mean that the user has "fully logged
>   out", how to hook into such an event and perform the code
>   suggested above?

Officially, when the last process owned by the user exits.
(This is the main advantage of the mount-namespace based approach.)
In practice, *I* would be fine with "at shutdown, and make sure it's
gone at boot."

HTH,
Isaac Dunham
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

You are right Edward, i was thinking in the transposition matrix.


El 11/09/15 a las 19:32, Edward Bartolo escribió:


only square matrices can
have an inverse


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

A * (1/A) = 1 = (1/A) * A

So, it must be square :-)

On 11/09/15 20:57, Jonathan Wilkes wrote:

El 11/09/15 a las 19:32, Edward Bartolo escribió:


only square matrices can
have an inverse


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Mirroring Devuan

2015-09-11 Thread aitor_czr

Hi,

I started mirroring Devuan:

http://188.165.204.61/repo/

I hope to have enought space in the hard disk: a dedicated server 
machine in SoYouStart (OVH).


Aitor.
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread Peter Olson
> On September 11, 2015 at 2:24 PM aitor_czr  wrote:
> 
> No!
> 
> Only square matrices can have a determinant.
> 
> I am not Roger Penrose. I am a hooligan of *Richard Feynman*
> and *Lev Davidovick Landau* (vintage).

Perhaps also with some variation *Joseph-Louis Lagrange* :-)

Peter Olson
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


[DNG] Devuan Mirror

2015-09-11 Thread Rod Rodolico
I sent an e-mail about a week ago to the list. I'm willing to mirror
Devuan, I just do not have the information I need to do it.

If anyone wants another mirror. It would be in Dallas, US. I just need
to know how much space and bandwidth it will need, plus instructions on
how to set up the mirror.

Rod
-- 
Rod Rodolico
Daily Data, Inc.
POB 140465
Dallas TX 75214-0465
214.827.2170
http://www.dailydata.net
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread KatolaZ
On Fri, Sep 11, 2015 at 10:48:19PM +0200, aitor_czr wrote:
> A * (1/A) = 1 = (1/A) * A
> 
> So, it must be square :-)
> 

I will become pedantic now, but if A is a matrix, the interpretation
of the equations above depends on what "1" and "/" actually mean for
you. In general, 1/A does not mean anything when you deal with
matrices. The symbol "A^{-1}" is normally used to denote the inverse
of A. And the inverse is defined only for square matrices. Hence your
"conclusion" is actually a fundamental hypothesys to make those
equations mean anything at all :)

HND

KatolaZ

-- 
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

I recomend you to eat a pizza with Jaromil

El 12/09/15 a las 00:18, KatolaZ escribió:

  will become pedantic now, but if A is a matrix, the interpretation
of the equations above depends on what "1" and "/" actually mean for
you. In general, 1/A does not mean anything when you deal with
matrices. The symbol "A^{-1}" is normally used to denote the inverse
of A. And the inverse is defined only for square matrices. Hence your
"conclusion" is actually a fundamental hypothesys to make those
equations mean anything at all:)

HND


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Debugging netman auto-connect.

2015-09-11 Thread aitor_czr

Of course... and Maxwell.. and many others...

El 11/09/15 a las 23:18, Peter Olson escribió:

On September 11, 2015 at 2:24 PM aitor_czr  wrote:
>
>No!
>
>Only square matrices can have a determinant.
>
>I am not Roger Penrose. I am a hooligan of*Richard Feynman*
>and*Lev Davidovick Landau*  (vintage).

Perhaps also with some variation*Joseph-Louis Lagrange*  :-)

Peter Olson


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] Devuan Mirror

2015-09-11 Thread Franco Lanza
On Fri, Sep 11, 2015 at 04:34:00PM -0500, Rod Rodolico wrote:
> I sent an e-mail about a week ago to the list. I'm willing to mirror
> Devuan, I just do not have the information I need to do it.
> 
> If anyone wants another mirror. It would be in Dallas, US. I just need
> to know how much space and bandwidth it will need, plus instructions on
> how to set up the mirror.

It's early to mirror devuan repositories, please
stand on and wait for when we will release the beta. After the beta,
we will start talking about mirroring repositories too.

-- 

Franco (nextime) Lanza
Lonate Pozzolo (VA) - Italy
SIP://c...@casa.nexlab.it
web: http://www.nexlab.net
paypal: https://paypal.me/nexlab

NO TCPA: http://www.no1984.org
you can download my public key at:
http://danex.nexlab.it/nextime.asc || Key Servers
Key ID = D6132D50
Key fingerprint = 66ED 5211 9D59 DA53 1DF7  4189 DFED F580 D613 2D50
---
echo 
16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D212153574F444E49572045535520454D20454B414D204F54204847554F4E452059415020544F4E4E4143205345544147204C4C4942snlbxq
 | dc
---



signature.asc
Description: PGP signature
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


[DNG] About the issues on the devuan repositories

2015-09-11 Thread Franco Lanza
Hi all,
after the last days issues with devuan repositories, 
i have deeply investigated what broke our amprolla merged repo.

First issue: debian mirror auto geolocation

Until some days ago we were using http://http.debian.net as auto
geolocation redirect for debian mirrors to be merged. Sadly those were
having issues, and then i've changed it pointing to the OVH mirror, and
then to the httpredir.debian.org mirrors. 

They seems to work, but amprolla wasn't yet able to work as expected,
so, tonight i have deeply investigated our issue... and i discovered a
change in the debian mirror structure.

They were used to have both an InRelease file AND a Release ( with
Release.gpg ) as main indices for repositories.

Amprolla was ignoring Release and Release.gpg files, and it was using
exclusively InRelease file, as it was signed and downloading 1 file
instead of 2 is more efficient.

Apparently something is changed in debian, and now debian mirrors
doesn't have InRelease anymore, they instead have only Release and
Release.gpg files.

For this reason, amprolla was assuming the debian repos were empty, and
then it was mergin the devuan repos with "nothing".

I've just patched amprolla with a work around to solve this issue,
anyway, as the debian repos aren't so stable in structure as i was
expecting, a major rewrite of amprolla will be rescheduled to be
anticipate, and it will perform a full mirror instead of using only
redirects.

This would say more bandwidth and disk space for us, but at least we can
be sure to not be affected from debian changes like in those days.

Thanks for your patience, in few hours the devuan repositories will be
up&running.
-- 

Franco (nextime) Lanza
Lonate Pozzolo (VA) - Italy
SIP://c...@casa.nexlab.it
web: http://www.nexlab.net
paypal: https://paypal.me/nexlab

NO TCPA: http://www.no1984.org
you can download my public key at:
http://danex.nexlab.it/nextime.asc || Key Servers
Key ID = D6132D50
Key fingerprint = 66ED 5211 9D59 DA53 1DF7  4189 DFED F580 D613 2D50
---
echo 
16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D212153574F444E49572045535520454D20454B414D204F54204847554F4E452059415020544F4E4E4143205345544147204C4C4942snlbxq
 | dc
---



signature.asc
Description: PGP signature
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng