cc  -o note_init  note_init.c

note_init

In urma executiei, se va afisa mesajul:

In "note.dat" 1000 pozitii (32000 octeti) nule

si fisierul este pregatit pentru a se opera asupra lui. Urmeaza compilarea si lansarea n executie a serverului:

cc  -o note_svc  note_svc.c

note_svc &

In acest moment, serverul este gata de a primi cereri de la clienti.

Aplicatia client ilustrata n sectiunea precedenta se pune n lucru:

cc  -o note  note.c

note  infosun1.scs.ubbcluj.ro  <I

******************************************************************

I fixed my problem. If I kill my existing session of rpcbind with 
the -s term flag and I restart rpcbind with -wi, I am able to run 
the program as myself. I am pretty sure this wouldn't have been 
found in the code.

Also, I did mean same program number. The TCP and UDP versions have 
the same program number but different port numbers, at least that 
is what rpcinfo -p said.

*********************************************************************************

florin@florin-laptop:~$ cd RPC/
florin@florin-laptop:~/RPC$ rpcbind
The program 'rpcbind' is currently not installed.  You can install it by typing:
sudo apt-get install rpcbind
florin@florin-laptop:~/RPC$ man 8 rpcbind
No manual entry for rpcbind in section 8
florin@florin-laptop:~/RPC$ sudo apt-get install rpcbind
[sudo] password for florin: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libgssglue1 libtirpc1
The following NEW packages will be installed:
  libgssglue1 libtirpc1 rpcbind
0 upgraded, 3 newly installed, 0 to remove and 113 not upgraded.
Need to get 140kB of archives.
After this operation, 508kB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
  libgssglue1 libtirpc1 rpcbind
Install these packages without verification [y/N]? y
Get:1 http://ro.archive.ubuntu.com/ubuntu/ lucid/main libgssglue1 0.1-4 [22.4kB]
Get:2 http://ro.archive.ubuntu.com/ubuntu/ lucid/universe libtirpc1 0.2.0-2 [77.0kB]
Get:3 http://ro.archive.ubuntu.com/ubuntu/ lucid/universe rpcbind 0.2.0-4 [40.7kB]
Fetched 140kB in 0s (383kB/s)   
Selecting previously deselected package libgssglue1.
(Reading database ... 122714 files and directories currently installed.)
Unpacking libgssglue1 (from .../libgssglue1_0.1-4_i386.deb) ...
Selecting previously deselected package libtirpc1.
Unpacking libtirpc1 (from .../libtirpc1_0.2.0-2_i386.deb) ...
Selecting previously deselected package rpcbind.
Unpacking rpcbind (from .../rpcbind_0.2.0-4_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up libgssglue1 (0.1-4) ...

Setting up libtirpc1 (0.2.0-2) ...

Setting up rpcbind (0.2.0-4) ...
update-rc.d: warning: rpcbind start runlevel arguments (S) do not match LSB Default-Start values (S 2 3 4 5)
 * Starting rpcbind daemon...                                            [ OK ] 

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
florin@florin-laptop:~/RPC$ rpcbind -iw
rpcbind: another rpcbind is already running. Aborting
florin@florin-laptop:~/RPC$ ./note_svc
Cannot register service: RPC: Authentication error; why = Client credential too weak
couldn't register prog 1073741824 vers 1

Eroare la inregistrare "get_note"florin@florin-laptop:~/RPC$ ps
  PID TTY          TIME CMD
 1749 pts/0    00:00:00 bash
 2012 pts/0    00:00:00 ps
florin@florin-laptop:~/RPC$ rpcbind
rpcbind: another rpcbind is already running. Aborting
florin@florin-laptop:~/RPC$ ps aux |grep rpcbind
root      2000  0.0  0.0   2252   864 ?        Ss   09:26   0:00 /sbin/rpcbind -w
florin    2024  0.0  0.0   3320   804 pts/0    S+   09:28   0:00 grep --color=auto rpcbind
florin@florin-laptop:~/RPC$ sudo kill 2000
florin@florin-laptop:~/RPC$ ps aux |grep rpcbind
florin    2029  0.0  0.0   3320   804 pts/0    S+   09:28   0:00 grep --color=auto rpcbind
florin@florin-laptop:~/RPC$ rpcbind -iw
rpcbind: /var/run/rpcbind.lock: Permission denied
florin@florin-laptop:~/RPC$ sudo rpcbind -iw
florin@florin-laptop:~/RPC$ ./note_svc&
[1] 2038
florin@florin-laptop:~/RPC$ ./note <I

p	A	21	10	31	4	a	
Segmentation fault
florin@florin-laptop:~/RPC$ ^C
florin@florin-laptop:~/RPC$ ^C
florin@florin-laptop:~/RPC$ 

***************************************************************************

florin@florin-laptop:~$ cd RPC/
florin@florin-laptop:~/RPC$ ./note_svc&
[1] 1738
florin@florin-laptop:~/RPC$ Cannot register service: RPC: Authentication error; why = Client credential too weak
couldn't register prog 1073741824 vers 1

Eroare la inregistrare "get_note"
[1]+  Exit 1                  ./note_svc
florin@florin-laptop:~/RPC$ ps aux |rpcbind
rpcbind: another rpcbind is already running. Aborting
florin@florin-laptop:~/RPC$ ps aux |grep rpcbind
root      1079  0.0  0.0   2252   848 ?        Ss   09:38   0:00 /sbin/rpcbind -w
florin    1766  0.0  0.0   3324   876 pts/0    S+   09:39   0:00 grep --color=auto rpcbind
florin@florin-laptop:~/RPC$ sudo kill 1079
[sudo] password for florin: 
Sorry, try again.
[sudo] password for florin: 
florin@florin-laptop:~/RPC$ rpcbind -iw
rpcbind: /var/run/rpcbind.lock: Permission denied
florin@florin-laptop:~/RPC$ sudo rpcbind -iw
florin@florin-laptop:~/RPC$ ./note_svc&
[1] 1783
florin@florin-laptop:~/RPC$ ./note 127.0.0.1 <I

p	A	21	10	31	4	a	
Uid         : A

xdr_note_t
put_note
xdr_Uid
*** glibc detected *** ./note_svc: munmap_chunk(): invalid pointer: 0xbfc66a20 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x3f8591]
/lib/tls/i686/cmov/libc.so.6(+0x6c80e)[0x3f980e]
/lib/tls/i686/cmov/libc.so.6(xdr_string+0xb0)[0x484550]
./note_svc[0x8048ab4]
/lib/tls/i686/cmov/libc.so.6(+0xf6323)[0x483323]
/lib/tls/i686/cmov/libc.so.6(+0xf5b30)[0x482b30]
/lib/tls/i686/cmov/libc.so.6(svc_getreq_common+0x206)[0x481be6]
/lib/tls/i686/cmov/libc.so.6(svc_getreq_poll+0x95)[0x481ff5]
/lib/tls/i686/cmov/libc.so.6(svc_run+0xb7)[0x4826b7]
./note_svc[0x8048c48]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x3a3bd6]
./note_svc[0x8048691]
======= Memory map: ========
0038d000-004e0000 r-xp 00000000 08:05 790945     /lib/tls/i686/cmov/libc-2.11.1.so
004e0000-004e1000 ---p 00153000 08:05 790945     /lib/tls/i686/cmov/libc-2.11.1.so
004e1000-004e3000 r--p 00153000 08:05 790945     /lib/tls/i686/cmov/libc-2.11.1.so
004e3000-004e4000 rw-p 00155000 08:05 790945     /lib/tls/i686/cmov/libc-2.11.1.so
004e4000-004e7000 rw-p 00000000 00:00 0 
00502000-00503000 r-xp 00000000 00:00 0          [vdso]
00618000-00635000 r-xp 00000000 08:05 786607     /lib/libgcc_s.so.1
00635000-00636000 r--p 0001c000 08:05 786607     /lib/libgcc_s.so.1
00636000-00637000 rw-p 0001d000 08:05 786607     /lib/libgcc_s.so.1
00abc000-00ad7000 r-xp 00000000 08:05 786549     /lib/ld-2.11.1.so
00ad7000-00ad8000 r--p 0001a000 08:05 786549     /lib/ld-2.11.1.so
00ad8000-00ad9000 rw-p 0001b000 08:05 786549     /lib/ld-2.11.1.so
08048000-08049000 r-xp 00000000 08:05 2362314    /home/florin/RPC/note_svc
08049000-0804a000 r--p 00000000 08:05 2362314    /home/florin/RPC/note_svc
0804a000-0804b000 rw-p 00001000 08:05 2362314    /home/florin/RPC/note_svc
090b7000-090d8000 rw-p 00000000 00:00 0          [heap]
b7876000-b7877000 rw-p 00000000 00:00 0 
b7884000-b7887000 rw-p 00000000 00:00 0 
bfc55000-bfc6a000 rw-p 00000000 00:00 0          [stack]
xdr_note_txdr_note_t
xdr_Uid
S-a adaugat:
A.Uid       : A
Teme si note:
 21 10  31 4 
Observatii  : a

p	B	22	9	32	7	b	
Uid         : B
RPC: Unable to receivexdr_note_t
"put_note" EROARE callrpc[1]+  Aborted                 ./note_svc
florin@florin-laptop:~/RPC$ 

